ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Offset Range Naming (https://www.excelbanter.com/excel-programming/393210-offset-range-naming.html)

Richard

Offset Range Naming
 
I am trying (very) to create some code that will create a range name starting
at cell B10, down to the final row with data in that column. I have a
starting point of

Finalrow = Range("F65536").End(xlUp).Row

Which uses column F to find the final row with data. I would like
assistance with the next line(s) of code to create a range called AssignedTo

Thanks in Advance for your help

Mike H

Offset Range Naming
 
Richard,

I'm not completely certain what you want so belwo are 3 different ranges:-

Sub versive()


finalrow = Range("F65536").End(xlUp).Row
Set AssignedTo = Range("B10:F" & finalrow)


finalrow = Range("B65536").End(xlUp).Row
Set AssignedTo1 = Range("B10:B" & finalrow)
AssignedTo1.Select

finalrow = Range("B65536").End(xlUp).Row
Set AssignedTo2 = Range("B10:B" & finalrow).Offset(1, 1)' alter the offset
to suit
AssignedTo2.Select

End Sub

Mike

"Richard" wrote:

I am trying (very) to create some code that will create a range name starting
at cell B10, down to the final row with data in that column. I have a
starting point of

Finalrow = Range("F65536").End(xlUp).Row

Which uses column F to find the final row with data. I would like
assistance with the next line(s) of code to create a range called AssignedTo

Thanks in Advance for your help


Richard

Offset Range Naming
 
Mike thanks

As you have probably guessed, like most on this site I am new to the VBA
side and haven't quite got my head around it yet.

The version of your code that works for me is

finalrow = Range("F65536").End(xlUp).Row
Set AssignedTo = Range("B10:B" & finalrow)
AssignedTo.Select

Many Thanks
You have saved my sanity



"Mike H" wrote:

Richard,

I'm not completely certain what you want so belwo are 3 different ranges:-

Sub versive()


finalrow = Range("F65536").End(xlUp).Row
Set AssignedTo = Range("B10:F" & finalrow)


finalrow = Range("B65536").End(xlUp).Row
Set AssignedTo1 = Range("B10:B" & finalrow)
AssignedTo1.Select

finalrow = Range("B65536").End(xlUp).Row
Set AssignedTo2 = Range("B10:B" & finalrow).Offset(1, 1)' alter the offset
to suit
AssignedTo2.Select

End Sub

Mike

"Richard" wrote:

I am trying (very) to create some code that will create a range name starting
at cell B10, down to the final row with data in that column. I have a
starting point of

Finalrow = Range("F65536").End(xlUp).Row

Which uses column F to find the final row with data. I would like
assistance with the next line(s) of code to create a range called AssignedTo

Thanks in Advance for your help



All times are GMT +1. The time now is 09:59 AM.

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