Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Brian
 
Posts: n/a
Default macro code shortcut

I am using the following code in a macro and the purpose is to have cells in
a column take on the value of the cells in the column beside it...

Private sub
range ("i7:i600").value=Range("h7:h600").value
range ("h7:h600").value=Range("g7:g600").value
range ("g7:g600").value=Range("f7:f600").value
end sub

I want to expand the above macro to do approximately 100 additional columns.
Do I have to write out each line individually or is there a shorter code that
will do this.

Thanks.



  #5   Report Post  
Art
 
Posts: n/a
Default

Try this:

Sub test()
Dim i As Integer
For i = 9 To 7 Step -1
Range(Cells(1, i), Cells(600, i)).Value = _
Range(Cells(1, i - 1), Cells(600, i - 1)).Value
Next i
End Sub

Art


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
Macro Shortcut Keys Nicolle K. Excel Discussion (Misc queries) 1 January 6th 05 04:55 PM
Moving down one row in a macro Cathy S. New Users to Excel 3 January 4th 05 09:02 PM
Zip Code Macro Ken Wright Excel Worksheet Functions 0 December 9th 04 07:55 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


All times are GMT +1. The time now is 11:30 PM.

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

About Us

"It's about Microsoft Excel"