Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How copy none excel data & paste in 2007 without overwriting data | Excel Discussion (Misc queries) | |||
EXCEL PASTE DOES NOT CHANGE DATA - PASTE DOESN'T WORK! | Excel Worksheet Functions | |||
Paste data into another workbook but not overwriting original data | Excel Programming | |||
filted data, copy and paste a col. puts data in wrong row how fix | New Users to Excel | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) |