new user - Need help

gapa

New Member
Joined
Jul 3, 2007
Messages
10
Hi,

I am a new user to Excel VBA.

Basically I want to perform a loop that searched values in a Row.

Normally, if it is in a column, this is what I would do

========

aaa=2

Do until Range("A"& aaa)="Something"
aaa=aaa+1
loop

========


How would i change this to look thru the rows ?

Thanks

Paul
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Perhaps you can be more specific as to what you want to do. The example you have posted will look through rows as you have asked until it finds a particular value and then stops without doing anything else :unsure:
 
Upvote 0
Code:
Private Sub CommandButton1_Click()
aaa = 2

Do Until Range("A1").Offset(0, aaa) = "X"
aaa = aaa + 1
Loop
End Sub
 
Upvote 0
hi,

Acutally, I want it to look thru the range heading of a pivot table, almost similar to a hlookup function. I need to know the column number so that I can make refers to it.

Hope this is clearer. But i guess the "offset" will works just as well

thanks
 
Upvote 0

Forum statistics

Threads
1,218,620
Messages
6,143,515
Members
450,492
Latest member
Rusbus1972

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