PDA

View Full Version : Solved: Programmatically naming an offset cell....



DanOfEarth
03-19-2011, 04:48 PM
Olah guys!!:wavey:

I'm a bit rusty....I'm trying to create a simple sub I can attach to a button that names a cell 12 cells over using the active cell's text.

Obviously, the following doesn't work but it explains what I'm trying to do.


Sub NameCell()
ActiveCell.Offset(0, 12).Names.Add Name:=ActiveCell.Text
ActiveCell.Offset(1, 0).Select
End Sub

mikerickson
03-19-2011, 05:07 PM
Try

With ActiveCell
.Offset(0, 12).Name = .Text
End With

DanOfEarth
03-20-2011, 09:52 AM
That worked. Boy do I feel sheepish. :bink:

You rock my man.:super:

PS - Man I love these smilies. So....for everybody else and on a lighter, Sunday morning :coffee: note:
:king: I'm sure the forum owners did lots of research :creator: :reading: :read: collecting all of those cool little smilies. And, it's a pain in rear to organize them :work: and load them :type into the modules. I'm sure they did that with intentions of people using them:bat2: . Shame :nono on you guys for not using them more often. I bit frustrating :banghead: I'm sure for the owners.
So I was thinking:thinking: . I say :old: from here on out, everybody should pledge :clever: to use at least one smilie per thread.
Now, I'm not saying we just beat each other over the head :fighting: with them for no reason. It should be there for a creative reason.
Such as:
Boy, this problem is a real p*sser::fireman:
Or....
You :censored: nucklehead....did you try Googling that first :igiveup: before bothering us? (I'm guilty of that one).
If that was the case, you might even dig up :turnip: a reason to save:shark: some of the really weird ones that are stuck at the bottom of the smilie list :jail: .(ok...that was a stretch)
Because maybe....just maybe.....the extra thinking :Thinkingo you have to do to actually use half of these d**m things in context :writer: will force you to think through :sleuth: the problem at hand. Or...if nothing else, it just might brighten up your day a little more.:bigdance2
(at least that was the intention of this silly post.)