VBA Return Column number of "RTE" in Row 1

shane_aldrich

Board Regular
Joined
Oct 23, 2009
Messages
148
I'm trying to Dim lRTE As Long

RTE is text in row 1, it will appear only once, but can shift column locations

It's the easy ones that throw me.

Thanks,
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I'm trying to Dim lRTE As Long

RTE is text in row 1, it will appear only once, but can shift column locations

It's the easy ones that throw me.

Thanks,

Hi Shane, I think you will need to give a better explanation of the problem. If you Dim RTE as Long then you have to give it a numerical value and use it as an integer in your code. From your post, it appears that you are using it on the worksheet and trying to reference it in your code somehow, but I am not sure about that. There is not enough information to really identify the problem.

Maybe you want to use a Find statement like:

Set fCel = Find("RTE", LookIn:=xlValue)
If Not fCel Is Nothing Then
Columns(fCel.Column).Interior.ColorIndex = 15
End If

But you would not Dim RTE, just use it to locat a cell the and then use the variable to make the column reference.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,203,681
Messages
6,056,708
Members
444,885
Latest member
Mark Prillman

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