View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Syntax Fpr Range Command

Are you getting an error message, and if so, what is it?

"Minitman" wrote:

Greetings,

I have two subs to put data from some TextBoxes (TB1 thru TB34) on a
UserForm onto a row on a sheet.

The first sub places the data in the first empty row - this one works.
Here is the code:

With Range("A65536").End(xlUp)
For i = 1 To 34
.Offset(0, i).Value = _
Me.Controls("TB" & i).Value
Next i
End With

The other sub is supposed to overwrite the row chosen from a ComboBox.
These two subs are identical except for the choice of which row to put
the data into.
Here is the second sub:

vRowToModify = CB1.ListIndex + 1

With Range("A" & vRowToModify)
For i = 1 To 34
.Offset(0, i).Value = _
Me.Controls("TB" & i).Value
Next i
End With

The variable vRowToModify does return the correct row number but I'm
not sure how to use it. the Range statement is not right and that is
messing up the sub

Can someone help me with the syntax of this "With" statement? Nothing
I have tried works.

Any help is greatly appreciated,

-Minitman