Edmond
10-24-2018, 10:52 AM
Hello Everyone,
I am starting to spend some time learning VBA programming by trying to understand what others are doing.
I just ran across this code:
Columns("J:J").Select
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
N = ActiveCell.Row
N1 = N
Cells(i, 11).Value = Cells(N, 2).Value
i = i + 1
Selection.FindNext(After:=ActiveCell).Activate
N = ActiveCell.Row
Do While N <> N1
Cells(i, 11).Value = Cells(N, 2).Value
Selection.FindNext(After:=ActiveCell).Activate
N = ActiveCell.Row
i = i + 1
Loop
I am trying to understand line by line:
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Does this line mean that all cells equal to 1 are activated?
N1 = N Cells(i, 11).Value = Cells(N, 2).Value
i = i + 1
Selection.FindNext(After:=ActiveCell).Activate
N = ActiveCell.Row
I don't understand either the N1=N
I have run that Macro so I understand what it does. But line by line I'm not able to reproduce it because I don't understand all the line.
I hope my explanations were sufficiently clear.
Have a good day
Edmond
I am starting to spend some time learning VBA programming by trying to understand what others are doing.
I just ran across this code:
Columns("J:J").Select
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
N = ActiveCell.Row
N1 = N
Cells(i, 11).Value = Cells(N, 2).Value
i = i + 1
Selection.FindNext(After:=ActiveCell).Activate
N = ActiveCell.Row
Do While N <> N1
Cells(i, 11).Value = Cells(N, 2).Value
Selection.FindNext(After:=ActiveCell).Activate
N = ActiveCell.Row
i = i + 1
Loop
I am trying to understand line by line:
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Does this line mean that all cells equal to 1 are activated?
N1 = N Cells(i, 11).Value = Cells(N, 2).Value
i = i + 1
Selection.FindNext(After:=ActiveCell).Activate
N = ActiveCell.Row
I don't understand either the N1=N
I have run that Macro so I understand what it does. But line by line I'm not able to reproduce it because I don't understand all the line.
I hope my explanations were sufficiently clear.
Have a good day
Edmond