View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Patrick C. Simonds Patrick C. Simonds is offline
external usenet poster
 
Posts: 343
Default How to reference a range from a UserForm

I would like to put this code in a module outside of UserForm1 but the
module stops when it gets to rng1(1, 6).

The UserForm is displayed when the code is run and there is a line:

Dim rng1 As Range

in the General Declaration area of the UserForm, and I have the following:

Set rng1 = Cells(ActiveCell.Row, 1)

which run prior to calling the routine below.



Sub TextBoxData()

'No Show 1

UserForm1.TextBox2202.Value = rng1(1, 6)
'Date of No Show
UserForm1.TextBox2202.Value = Format$(UserForm1.TextBox2202.Value,
"ddd dd mmm yy")
UserForm1.TextBox2203.Value = rng1(1, 7)

End Sub