Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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. |
#2
![]() |
|||
|
|||
![]()
if col g becomes the values of col f, how does now col h become the value
for col g?? -- Don Guillett SalesAid Software "Brian" wrote in message ... 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. |
#3
![]() |
|||
|
|||
![]()
The code described below will do this. I am just wondering if there is a
better(shorter) way to write the code to do many more columns. There may not be a shorter way to write this. "Don Guillett" wrote: if col g becomes the values of col f, how does now col h become the value for col g?? -- Don Guillett SalesAid Software "Brian" wrote in message ... 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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro Shortcut Keys | Excel Discussion (Misc queries) | |||
Moving down one row in a macro | New Users to Excel | |||
Zip Code Macro | Excel Worksheet Functions | |||
Macro and If Statement | Excel Discussion (Misc queries) | |||
Macro for multiple charts | Excel Worksheet Functions |