Inserting TextBox1 Value into Conditional Column/Row4

T

Todd Huttenstine

Sheets("Team Data").Range("X2").Value & "4" = TextBox1.Value

I am trying to write a code(located above) that will insert TextBox1 value
into a cell on Row4. The Column Letter will always be located in cell X2.
For instance, if the value in cell X2 is "W", then I need the code to enter
TextBox1.Value into cell W4. Here is the code I have so far. Right now the
code is coming up color red and saying compile error: expected expression.
I can not figure out what I'm doing wrong. Can anyone tell me what the
correct code would be?

Thank you
Todd Huttenstine
 
J

J.E. McGimpsey

One way:

With Sheets("Team Data")
.Range(.Range("X2").Value & 4).Value = TextBox1.Value
End With
 
J

J.E. McGimpsey

Note that this will fail if Sheet Team Data is not the active sheet
since Range("X2") is not qualified
 
V

Vasant Nanavati

Thanks, J.E.; good catch.

Regards,

Vasant.

J.E. McGimpsey said:
Note that this will fail if Sheet Team Data is not the active sheet
since Range("X2") is not qualified
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top