Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default Return actual range not cell value in variable

Hi, forgive my poor coding, as I haven't learnt VBA at all. How do I
ger rowendrange and nowrow to return the cell range instead of the
cell value?

Dim rowend As String
Dim rowendrange As Range
Dim nowrow As Range
Dim lastrow As Range

If Me.TextBox1.Value = "" Then
rowend = 0
Else
rowend = Me.TextBox1.Value
End If

rowendrange = ActiveCell.Offset(rowend, 0).Range
nowrow = ActiveCell.Offset(0, -2).Range

Me.TextBox2.Value = nowrow
Me.TextBox3.Value=rowendrange

Thanks in advance

Rich
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Return actual range not cell value in variable

I think when you are saying "range" you actually mean "address". In which
case, change the two lines to:

rowendrange = ActiveCell.Offset(rowend, 0).Address
nowrow = ActiveCell.Offset(0, -2).Address

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Richhall" wrote:

Hi, forgive my poor coding, as I haven't learnt VBA at all. How do I
ger rowendrange and nowrow to return the cell range instead of the
cell value?

Dim rowend As String
Dim rowendrange As Range
Dim nowrow As Range
Dim lastrow As Range

If Me.TextBox1.Value = "" Then
rowend = 0
Else
rowend = Me.TextBox1.Value
End If

rowendrange = ActiveCell.Offset(rowend, 0).Range
nowrow = ActiveCell.Offset(0, -2).Range

Me.TextBox2.Value = nowrow
Me.TextBox3.Value=rowendrange

Thanks in advance

Rich

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return a value if variable is in a range plally Excel Discussion (Misc queries) 3 October 23rd 08 08:27 PM
Storing a range variable in a cell Dreaded404 Excel Discussion (Misc queries) 1 July 2nd 08 03:37 PM
Variable Cell Range Reference Ken Excel Worksheet Functions 3 August 12th 07 07:35 PM
VLOOKUP variable range cell reference Ohp Excel Worksheet Functions 2 July 3rd 07 02:52 PM
Finding max array value of variable cell range The Fisherman Excel Discussion (Misc queries) 0 February 6th 07 02:54 PM


All times are GMT +1. The time now is 08:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"