Paste data from AJ to K
I would like to create a macro that performs the following steps but I am
unsuccessful. Can you help me? 1. Check Column AJ for data starting in Row2. 2. If Column AJ has data check the same row of Column K for data 3. If Column K is blank paste the data from the same row of Column AJ into Column K |
Paste data from AJ to K
Hi,
How about this Sub Copy_Rows() Dim LastRow As Long Dim MyRange as range, C as range Set sht = Sheets("Sheet1") LastRow = sht.Cells(Cells.Rows.Count, "AJ").End(xlUp).Row Set MyRange = Range("AJ2:AJ" & LastRow) For Each c In MyRange If Len(c.Value) 0 And Len(c.Offset(, -25)) = 0 Then c.Offset(, -25) = c.Value End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Louie" wrote: I would like to create a macro that performs the following steps but I am unsuccessful. Can you help me? 1. Check Column AJ for data starting in Row2. 2. If Column AJ has data check the same row of Column K for data 3. If Column K is blank paste the data from the same row of Column AJ into Column K |
Paste data from AJ to K
Wow this is really good. Thank you!
"Mike H" wrote: Hi, How about this Sub Copy_Rows() Dim LastRow As Long Dim MyRange as range, C as range Set sht = Sheets("Sheet1") LastRow = sht.Cells(Cells.Rows.Count, "AJ").End(xlUp).Row Set MyRange = Range("AJ2:AJ" & LastRow) For Each c In MyRange If Len(c.Value) 0 And Len(c.Offset(, -25)) = 0 Then c.Offset(, -25) = c.Value End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Louie" wrote: I would like to create a macro that performs the following steps but I am unsuccessful. Can you help me? 1. Check Column AJ for data starting in Row2. 2. If Column AJ has data check the same row of Column K for data 3. If Column K is blank paste the data from the same row of Column AJ into Column K |
All times are GMT +1. The time now is 12:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com