GMSlam
06-18-2018, 10:28 AM
Hi,
New to VBA/Excel.
I'm trying to change the value of a cell with goal seek to a value by changing the cell in the column next to it. I cant seem to find out how to set the last range to the last cell in the column.
I attempted placing Worksheets("Hours").Cells(Rows.Count, 5).End(xlUp) directly in along with a number of other attempts and I'm at the point where I just need to walk away and come back.
Sub CalcEndTime()
'
' CalcEndTime Macro
'
' Keyboard Shortcut: Ctrl+t
'
Dim Lastrow As Range
Lastrow = ActiveSheet.Cells(Rows.Count, 5).End(xlUp).Row
Application.CutCopyMode = False
Worksheets("Hours").Cells(Rows.Count, 5).End(xlUp).Offset(0, 1).GoalSeek Goal:=8, ChangingCell:=Range(Lastrow)
End Sub
Error message says RTE 1004: Method 'Range' of object'_Global' failed
New to VBA/Excel.
I'm trying to change the value of a cell with goal seek to a value by changing the cell in the column next to it. I cant seem to find out how to set the last range to the last cell in the column.
I attempted placing Worksheets("Hours").Cells(Rows.Count, 5).End(xlUp) directly in along with a number of other attempts and I'm at the point where I just need to walk away and come back.
Sub CalcEndTime()
'
' CalcEndTime Macro
'
' Keyboard Shortcut: Ctrl+t
'
Dim Lastrow As Range
Lastrow = ActiveSheet.Cells(Rows.Count, 5).End(xlUp).Row
Application.CutCopyMode = False
Worksheets("Hours").Cells(Rows.Count, 5).End(xlUp).Offset(0, 1).GoalSeek Goal:=8, ChangingCell:=Range(Lastrow)
End Sub
Error message says RTE 1004: Method 'Range' of object'_Global' failed