How to offset a RefEdit1 Cell Value

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
563
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Code:
Private Sub cmdbtnDone_Click()  Dim r As Range, r1 As Range
  Set r = Range(RefEdit1)
  Set r1 = r(1)
  Debug.Print r1.Address
  Debug.Print ActiveCell.Offset(0, 1).Range(r1.Address).Select
End Sub
The above code finds the first cell of the Range selection from the RefEdit. Then for test purposes only, it displays the range in the Immediate box in VBA. Which it does with the Debug.Print r1.Address. But what I need to do is to offset the r1.Address cell value, which in this case is (0 rows, and 1 column to the right) and display the new cell range with the second debug.print. All that displays is the value of "True". How can I display the new cell value of the same row and one column to the rights value? Thank You.
 
If r1 is still referencing the range A1:XFD1048576 you'll get an error however you try and offset from it.

What is r1 mean to refer to?
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
If references the beginning of the range. Example: if the selected using the Refedit control is from Range($H$7:$H$15), then it will display the value of Cell($H$7). Or if the selected using the Refedit control is from Range($H$20:$H$35) then it will display the value of Cell($H$20). Thank you.
 
Upvote 0
I'm totally confused.:eek:

In the last code you posted r1 referred to a range that covered an entire worksheet, a RefEdit control didn't appear to be involved anywhere.

If r1 was referring to H7:H15, H7, H20:H35 or H20 then this line of code would not cause an error.
Code:
Chattemfrm.txtBxLtNum = r1.Offset(0, -3).Address

What are you actually trying to do?
 
Upvote 0
Instead of setting the range to cover the entire sheet, I probably should of done the below code:
Code:
 Set r1 = Range(RefEdit1)
I haven't tried it out yet.
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top