Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue.

J

jonH

I'm trying to name a range to automate some charting. The range I wan
to name begins in in cell b3 and ends in b36. The issue is that cell
b3 - b20 are blank for example. Within Excel, I can select CTRL
SHIFT+ DOWN twice to select the entire range. VBA however, will no
allow me to perform this action twice. It simply ignores the secon
command. I'm using the Range(selection,selection(xldown).selec
command. Any suggestions
 
K

keepitcool

no selection needed.. you know the address.. keep it simple!

Sub NameIt()
ActiveSheet.Range("B3:B36").Name = "MyGlobalName"
ActiveSheet.Range("B3:B36").Name = ActiveSheet.Name & "!MyLocalName"
End Sub

Tip: save y'self some aggravation and buy a simple VBA book.
once you understand the basics the rest will be easy.

keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top