ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Naming range question (https://www.excelbanter.com/excel-programming/373028-naming-range-question.html)

Billy B

Naming range question
 
I want to name a range (fulldata) starting at cell A2 on the worksheet and
ending at the last cell with a value in it on the same worksheet using VBA
code. Again, I need help.

Thank you.

Nigel

Naming range question
 
Dim myRange As Range
Set myRange = Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
myRange.Name = "fulldata"


--
Cheers
Nigel



"Billy B" wrote in message
...
I want to name a range (fulldata) starting at cell A2 on the worksheet and
ending at the last cell with a value in it on the same worksheet using VBA
code. Again, I need help.

Thank you.




Billy B

Naming range question
 
Thank you. This works to find the last cell in the same column but I need to
find the last cell used on the worksheet. It might be N1800 or G50. It will
never be the same. Could you help me with that?

"Nigel" wrote:

Dim myRange As Range
Set myRange = Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
myRange.Name = "fulldata"


--
Cheers
Nigel



"Billy B" wrote in message
...
I want to name a range (fulldata) starting at cell A2 on the worksheet and
ending at the last cell with a value in it on the same worksheet using VBA
code. Again, I need help.

Thank you.





Bob Phillips

Naming range question
 
Set rng = Range("fulldata")(Range("fulldata").Count)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Billy B" wrote in message
...
Thank you. This works to find the last cell in the same column but I need

to
find the last cell used on the worksheet. It might be N1800 or G50. It

will
never be the same. Could you help me with that?

"Nigel" wrote:

Dim myRange As Range
Set myRange = Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
myRange.Name = "fulldata"


--
Cheers
Nigel



"Billy B" wrote in message
...
I want to name a range (fulldata) starting at cell A2 on the worksheet

and
ending at the last cell with a value in it on the same worksheet using

VBA
code. Again, I need help.

Thank you.







Ken Johnson

Naming range question
 
Dim rngfulldata As Range
Set rngfulldata = Range("A2:" & _
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Address)
rngfulldata.Name = "fulldata"

Ken Johnson



All times are GMT +1. The time now is 03:28 AM.

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