VBA finding text and assigning variable

cmefly

Well-known Member
Joined
May 13, 2003
Messages
683
Hi,

For the life of me i can't figure this one out...and it seems easy..(or so i think)...blah!

using VBA - i'm trying to find every cell in column B that is equal to "AAA". Then, i'd like to assign a variable its location (for example, if B9 = "AAA", then variable A = 9, if the next time it finds "AAA" is in cell B400 then variable B = 400....etc in that order). The maximum number of "AAA" that can be found is 25.

is this possible? I'm having problems looping through the alphabet....

thanks,

Marc
 
Code:
Selection.Formula = "=UPPER(hidden1!A" & j & ")[COLOR=Red]&[/COLOR] is great"
See if this can help!!!
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
:( nope...

does it have anything to do with the store variable being declared as long....

??
 
Upvote 0
This was the line you where getting an error right?
And which variable are you talking about "J"?
 
Upvote 0
The source of my error is this:

Selection.Formula = "=UPPER(hidden1!A" & j & ")" & " is great"


when i do this...

Selection.Formula = "=UPPER(hidden1!A" & j & ")"

everything works fine....


what gives???
 
Upvote 0
I don't know what is the problem. that line is working fine with me.
as far as you loop is concerned the loop for J should be 1 to count -1.
 
Upvote 0
Code:
Selection.Formula = "=UPPER(hidden1!A" & j & ")& is great"


so you never used what i had given to you?
Please copy paste this Code
 
Upvote 0
my bad :(

sorry and thank you for your help...i tend to close of my quotes before putting an & sign...but i finally understand what you were trying to do...
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,277
Members
452,902
Latest member
Knuddeluff

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