Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How copy none excel data & paste in 2007 without overwriting data Wakefootin Excel Discussion (Misc queries) 2 October 8th 09 12:15 AM
EXCEL PASTE DOES NOT CHANGE DATA - PASTE DOESN'T WORK! robin l Excel Worksheet Functions 7 April 16th 09 07:56 PM
Paste data into another workbook but not overwriting original data Me Excel Programming 1 December 13th 07 05:51 PM
filted data, copy and paste a col. puts data in wrong row how fix chris_fig New Users to Excel 1 October 16th 06 04:26 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM


All times are GMT +1. The time now is 04:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"