ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. (https://www.excelbanter.com/excel-programming/300664-excel-vba-range-selection-selection-end-xldown-name-issue.html)

jonH

Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue.
 
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

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

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


--
Regards,
Tom Ogilvy

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


---
Message posted from http://www.ExcelForum.com/




keepITcool

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

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


jonH wrote:

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


---
Message posted from http://www.ExcelForum.com/




jonH

Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue.
 
Perfect. I think I tried everything but that. Thanks

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com