Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I have the code below attached to a command button (GoButton) on a
worksheet called "Main". For some reason, the code shuts down and wants to debug any line with 'Range...' in it. Does anyone know why? Private Sub GoButton_Click() Worksheets("InfoLoader").Activate Range("W1:W50").Select Selection.Value = "" Range("E7").Select ActiveCell.Value = ComboBox2.Value Range("E2").Select ActiveCell.Value = ComboBox3.Value Range("B" & Range("F2").Value + 14 & ":B" _ & Range("F4").Value + 14).Copy Destination:=Range("W1") End Sub Thanks in advance Steve |
#2
![]() |
|||
|
|||
![]()
Possibly there is some abiguity in the context of the button click. Try
the following. Also, given the With block, the Worksheets("InfoLoader").Activate may not be necessary. Private Sub GoButton_Click() Worksheets("InfoLoader").Activate With Worksheets("InfoLoader") ..Range("W1:W50") = "" ..Range("E7") = ComboBox2.Value ..Range("E2") = ComboBox3.Value ..Range("B" & .Range("F2").Value + 14 & ":B" _ & .Range("F4").Value + 14).Copy Destination:=.Range("W1") End With End Sub Jerry Steve wrote: I have the code below attached to a command button (GoButton) on a worksheet called "Main". For some reason, the code shuts down and wants to debug any line with 'Range...' in it. Does anyone know why? Private Sub GoButton_Click() Worksheets("InfoLoader").Activate Range("W1:W50").Select Selection.Value = "" Range("E7").Select ActiveCell.Value = ComboBox2.Value Range("E2").Select ActiveCell.Value = ComboBox3.Value Range("B" & Range("F2").Value + 14 & ":B" _ & Range("F4").Value + 14).Copy Destination:=Range("W1") End Sub Thanks in advance Steve |
#3
![]() |
|||
|
|||
![]()
That did the trick.
Thanks a lot for that. Steve |
#4
![]() |
|||
|
|||
![]()
You're welcome. Glad it helped.
Jerry Steve wrote: That did the trick. Thanks a lot for that. Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|