lexi0088
Technical User
- Sep 7, 2004
- 49
I know this may seem very simple, but I can not get this to work.
I have a button in excel that is linked to a macro. I want to be able to click on a random cell in column J and then click the button to run a macro in order to insert value into that cell.
My problem is that I cannot figure out how to make that cell in column J that I choose the active cell for my macro. Here is my macro. Any suggestions would be appreciative.
Application.Calculation = xlCalculationManual
ActiveRow = ActiveCell.Row
ActiveColumn = 10
RowNum = Range("J1").Value
Cells(ActiveRow, ActiveColumn).Value = Range("'Expense'!A" & RowNum).Value
Cells(ActiveRow, ActiveColumn + 1).Value = Range("'Expense'!B" & RowNum).Value
If Application.MoveAfterReturnDirection = xlToRight Then
Cells(ActiveRow, ActiveColumn + 2).Select
Else
Cells(ActiveRow + 1, ActiveColumn).Select
End If
Application.Calculation = xlCalculationAutomatic
I have a button in excel that is linked to a macro. I want to be able to click on a random cell in column J and then click the button to run a macro in order to insert value into that cell.
My problem is that I cannot figure out how to make that cell in column J that I choose the active cell for my macro. Here is my macro. Any suggestions would be appreciative.
Application.Calculation = xlCalculationManual
ActiveRow = ActiveCell.Row
ActiveColumn = 10
RowNum = Range("J1").Value
Cells(ActiveRow, ActiveColumn).Value = Range("'Expense'!A" & RowNum).Value
Cells(ActiveRow, ActiveColumn + 1).Value = Range("'Expense'!B" & RowNum).Value
If Application.MoveAfterReturnDirection = xlToRight Then
Cells(ActiveRow, ActiveColumn + 2).Select
Else
Cells(ActiveRow + 1, ActiveColumn).Select
End If
Application.Calculation = xlCalculationAutomatic