Variable not set

Cozzy123

New Member
Joined
Aug 10, 2016
Messages
28
I'm trying to use VBA to view fields in a textbox taken from a spreadsheet. That is working fine. What I want to do, if I want to update said spreadsheet, i.e. I reviewed the text in the textbox but I want to add an update I want to be able to over right the text that is there and put it back in the same cell place within the spreadsheet. I had this working fine on another spreadsheet I did years ago with the following code, but I must have done something else but I can't remember, and I can't find it in my code.

I used this code, and it previously worked, but its not working now, I've obviously forgot to do something.

Sheets("Table").Range("h1") = ComboBox3

Set r = Sheets("Data").Range("j9")
Set c = Sheets("Data").Range("j10")

Sheets("Table").Cells(r, c) = TextBoxtu.Value

Please help
 
Check the values of r and c at the time the code runs and make sure they are correct.
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
What I'm trying to do is find where the original text was entered into a spreadsheet table..... then overwrite it with the new text and put it back into the same place as the old text was.

So I used index match to find the location it was in the table, i.e row and column, and then reinput the text from the textbox back to the same cell (r and c), it works on my other sheet but not this one, so I'm not doing something correctly.
I have it working, thanks
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top