Slight change needed for my script

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

Instead of going to the top left of my worksheet but go straight to the cell
with "1" in it. This script is activated by a form button
--
Sub ThirtyOneDays()
With ActiveSheet.Buttons(Application.Caller).TopLeftCell
If .Column > 8 Then Cells(.Row - 24, .Column - 8).Select


..Offset(-5, -8) = "1"
..Offset(-5, -7) = "31"
..Offset(-4, -8) = "0"
..Offset(-4, -7) = "0"
..Offset(-3, -8) = "0"
..Offset(-3, -7) = "0"
End With
End Sub


Thanks in advance.........Bob Vance
 
I don't quite understand the question, but did you really want those offsets to
refer to the .topleftcell of the button?
 
Thanks worked it out below?

Sub ThirtyOneDays()
With ActiveSheet.Buttons(Application.Caller).TopLeftCell
If .Column > 8 Then Cells(.Row - 5, .Column - 8).Select


..Offset(-5, -8) = "1"
..Offset(-5, -7) = "31"
..Offset(-4, -8) = "0"
..Offset(-4, -7) = "0"
..Offset(-3, -8) = "0"
..Offset(-3, -7) = "0"
End With
End Sub
 
Back
Top