Determine Name of a Cell

BRich83

New Member
Joined
Jun 9, 2011
Messages
19
I have a number of cells named on a worksheet, and I want to run code that is variable based on the cell's name. Is there a way to determine what the cell's assigned name is? I already know how to define a cell's name, but I can't figure out how to read what it is.

I'm looking for something like this:
Code:
box = Cells(rw, cl).Name

Basically I want the macro to recognize where it is on a sheet, and then check the surrounding cells based on the name of the cell.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Ok, now I'm trying to call a new cells using what you just gave me and search for values, but I'm getting a type mismatch.

Code:
                'Guesses a number and checks box, col, and row
        For numguess = 1 To 9
        'Searches box
        bxnum = Mid(Cells(rw, cl).Name.Name, 4, 1) 'number of current box
        For i = 1 To 9
            If Cells("box" & bxnum & i).Value = numguess Then
                GoTo SkipNum
            End If
        Next i

bxnum refers to which box I'm currently in with an integer. I now want to search all 8 other cells in the area labeled "Box1x" with x being 1-9. It doesn't like how I'm trying to refer to the cell, but I thought you could call it by name. Ideas?
 
Upvote 0
Two easy questions, two easy answers. I feel dumb for that last one, I've used that before. Thank you again.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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