magento
asked on
Excel - more information
Can some one please help me understand abt the range,cell,rows and the lines below.
lRow = Range("A" & Rows.Count).End(xlUp).Row
For each cell in Range("B2:B" & lRow)
If Range("A" & cel.Row) <> "" Then Range("B1").Copy Destination:=cel
Next cel
lRow = Range("A" & Rows.Count).End(xlUp).Row
For each cell in Range("B2:B" & lRow)
If Range("A" & cel.Row) <> "" Then Range("B1").Copy Destination:=cel
Next cel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
lRow = Range("A" & Rows.Count).End(xlUp).Row
This line will assing last row number in column-A to 'lRow' variable.
Now, following loop will check for Row2 to lRow in Column-B that if a particular cell in Column-A is not blank then copy corresponding cell from Column-B to cell in Column-A
For each cell in Range("B2:B" & lRow)
If Range("A" & cel.Row) <> "" Then Range("B1").Copy Destination:=cel
Next cel
This line will assing last row number in column-A to 'lRow' variable.
Now, following loop will check for Row2 to lRow in Column-B that if a particular cell in Column-A is not blank then copy corresponding cell from Column-B to cell in Column-A
For each cell in Range("B2:B" & lRow)
If Range("A" & cel.Row) <> "" Then Range("B1").Copy Destination:=cel
Next cel
Sorry for the range 1:10 etc. read 2:10 row 1 is your master data you are copying when required.
Chris
Chris
ASKER
Can you please let me know the most used objects in vba code?
Most used objects ... I would hesitate to suggest it depends on your application and role for example ranges in excel and record sets in access with a smidgins of mail item in outlook, shape in ppt.
The list could be endless but scoping to your code range and excel!
Chris
The list could be endless but scoping to your code range and excel!
Chris
My answer is not directly to the point, but may give you hints an idea's for different ways to complete your entire 'project'.
Your code explained in worksheet operation would be this:
in B2 you type: =if(A2="","","$B$1)
Then you fill down the formula to the last filled cell in column A.
The advantage of working with formula's in this case is that you have immediate and automatic result.
Regards,
Davy
Your code explained in worksheet operation would be this:
in B2 you type: =if(A2="","","$B$1)
Then you fill down the formula to the last filled cell in column A.
The advantage of working with formula's in this case is that you have immediate and automatic result.
Regards,
Davy
ASKER
Thanks Chris
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Chris