ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   refedit controls and R1C1 notation (https://www.excelbanter.com/excel-programming/425383-refedit-controls-r1c1-notation.html)

Robert Flanagan

refedit controls and R1C1 notation
 
If a worksheet is set to use R1C1 notation, the entry in a refedit control
is in that notation when the user selects a cell. However the following
does not work:

dim selectedR as range
Set selectedR = Range(userform1.refedit1.text)

because of the R1C1 notation. The only solution I see is to check the
notation, set it to A1 notation, display the userform, get the information,
and then set the notation back to R1C1.

Is there a better way?

Bob




Tim Zych

refedit controls and R1C1 notation
 
Hi Bob. How about..

Dim s As String, selectedR As Range
s = UserForm1.RefEdit1.Text
If Application.ReferenceStyle = xlR1C1 Then
Set selectedR = Range(Application.ConvertFormula(s, xlR1C1, xlA1))
Else
Set selectedR = Range(s)
End If

--
Tim Zych
http://www.higherdata.com
Workbook Compare - free and pro versions

"Robert Flanagan" wrote in message
...
If a worksheet is set to use R1C1 notation, the entry in a refedit control
is in that notation when the user selects a cell. However the following
does not work:

dim selectedR as range
Set selectedR = Range(userform1.refedit1.text)

because of the R1C1 notation. The only solution I see is to check the
notation, set it to A1 notation, display the userform, get the
information, and then set the notation back to R1C1.

Is there a better way?

Bob






Robert Flanagan

refedit controls and R1C1 notation
 
Thanks Tim. That's a better solution than changing the setting.

Bob

"Tim Zych" <tzych@nospam at earthlink dot net wrote in message
...
Hi Bob. How about..

Dim s As String, selectedR As Range
s = UserForm1.RefEdit1.Text
If Application.ReferenceStyle = xlR1C1 Then
Set selectedR = Range(Application.ConvertFormula(s, xlR1C1, xlA1))
Else
Set selectedR = Range(s)
End If

--
Tim Zych
http://www.higherdata.com
Workbook Compare - free and pro versions

"Robert Flanagan" wrote in message
...
If a worksheet is set to use R1C1 notation, the entry in a refedit
control is in that notation when the user selects a cell. However the
following does not work:

dim selectedR as range
Set selectedR = Range(userform1.refedit1.text)

because of the R1C1 notation. The only solution I see is to check the
notation, set it to A1 notation, display the userform, get the
information, and then set the notation back to R1C1.

Is there a better way?

Bob









All times are GMT +1. The time now is 11:46 PM.

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