Hello, I have probably worded the title wrong but I will try my best to explain what I want to do below.
Basically, the macro has been created to move the data from columns I and J to columns F and G after payment has been received so that it goes round the same cycle each time, and it also removed the Y from column H. You should be able to see this in the code below, the macro has been put in a button where you see the "Click" text, however, I need to be able to do this for each row, is there a way I could use one button and choose the row I want to change each time instead of have the 'Click' on each row.
Or if this isnt possible is there a way so that instead of me manually editing the ranges and copying it down each row, i could place it in a cell and drag it down like I can with formulas.
I hope you understand what Im trying to say, thanks in advance for any help given. And if you do post any code could you please explain it as I am very new to this thanks.
Here is an image of the excel spreadsheet:
\1
Here is the Macro Code:
Sub Row2Macro()
'
' Row 2 Macro
' Updates Row to correct information.
'
Selection.Cut
Range("I2").Select
Application.CutCopyMode = False
Selection.Copy
Range("F2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("J2").Select
Application.CutCopyMode = False
Selection.Copy
Range("G2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("H2").Select
Application.CutCopyMode = False
Selection.ClearContents
End Sub
UPADATE: Chippy provided me with the following which is exactly what I am after except one issue, it doesnt perform the paste special and seems to removed the formulae from the 2 columns thanks, I have managed to put this in a module, so I just need this final tweak:
Originally Posted by
Chippy
Have the button call this routine instead of your code:
Public Sub Update_Row()
Dim rngSelect As Range
On Error Resume Next
Set rngSelect = Application.InputBox("Select any cell(s) on the row to be changed", "Update Row", Selection.Address, Type:=8)
On Error GoTo 0
If Not rngSelect Is Nothing Then
Range("F" & rngSelect.row & ":G" & rngSelect.row).Value = Range("I" & rngSelect.row & ":J" & rngSelect.row).Value
Range("I" & rngSelect.row & ":J" & rngSelect.row).ClearContents
Range("H" & rngSelect.row).ClearContents
End If
End Sub
Put the code in a module (not a sheet nor workbook module).
Update 2: Further edit its not the paste special that is the issue it removes the formulas from columns I and J Here are the before and afters:
Before Macro Payment Plans.xlsm
After Macro Payment Plans.xlsm
Bookmarks