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
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
its not working now
What exactly does that mean? What is happening? If J9 and J10 don't contain a row number and a column number/letter, that code will error out.
 
Upvote 0
What exactly does that mean? What is happening? If J9 and J10 don't contain a row number and a column number/letter, that code will error out.
Sorry, so those cells have got index match formulas looking for the text written in the combobox.

It then says which row and colomn they are in the spreadsheet.

I've obviously missed a load of stuff................... might have to go back over my old userforms as its been a long time since I did this.
 
Upvote 0
You still haven't said what is actually happening?
 
Upvote 0
A reminder:

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at:

There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
You're allowed to do it, you just need to provide links. (it's all explained in the rules)
 
Upvote 0
Based on your cross-post, the answer to my earlier question is that you are getting a "variable not defined" error, which simply means that you haven't declared one or more variables - e.g. you don't have a Dim r as Range, c as Range type line.
 
Upvote 0
Thank you Rory, that has got rid of my variable not set, but I'm obviously doing something wrong as its not updating my spreadsheet with the new data.
 
Upvote 0
Thank you Rory, that has got rid of my variable not set, but I'm obviously doing something wrong as its not updating my spreadsheet with the new data.
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.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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