Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear ALL
I have the following question: I placed the button on the excel sheet and assign a macro which cuts the cells' values from range b1:b4 and pastes them into range a10:d10 everything is ok and works perfectly, but how can I do so that when I press the button again the new values which i type in range b1:b4 placed in a11:d11 ? and so on, is it possible? Please help me with this Thank you in advance My Code: Private Sub CommandButton1_Click() If Range("A10") = "" Then Range("B1").Select Selection.Cut Range("A10").Select ActiveSheet.Paste Range("B2").Select Selection.Cut Range("B10").Select ActiveSheet.Paste Range("B3").Select Selection.Cut Range("C10").Select ActiveSheet.Paste Range("B4").Select Selection.Cut Range("D10").Select ActiveSheet.Paste Else Range("B1").Select Selection.Cut Range("A11").Select ActiveSheet.Paste Range("B2").Select Selection.Cut Range("B11").Select ActiveSheet.Paste Range("B3").Select Selection.Cut Range("C11").Select ActiveSheet.Paste Range("B4").Select Selection.Cut Range("D11").Select ActiveSheet.Paste End If End Sub what should I do to continue the code for next ranges? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Create a newworksheet with VBA code and put VBA code in the new worksheet module | Excel Programming | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming |