ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range < - String conversion. (https://www.excelbanter.com/excel-programming/294478-range-string-conversion.html)

y

Range < - String conversion.
 
Is there an automatic conversion?
I must ask the user for a range but the input box returns a string.

I check for "conversion" inside VBA help and I find out nothing.

Thanks Alex.


Frank Kabel

Range < - String conversion.
 
Hi
use the application.inputbox with the type:=8. e.g.

Sub foo()
....
Dim aralik As Range
On Error Resume Next
Set aralik = Application.InputBox(prompt:="Select range:", Type:=8)
If Err < 0 Then
Exit Sub
End If
On Error GoTo 0
' your code
....
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"y" schrieb im Newsbeitrag
...
Is there an automatic conversion?
I must ask the user for a range but the input box returns a string.

I check for "conversion" inside VBA help and I find out nothing.

Thanks Alex.



y

Range < - String conversion.
 
Hi Frank,

thanks for your tips.

Just a question:

why Set aralik = Application.Inp... ? and not aralik = Application.Inp...

Alex.



Frank Kabel

Range < - String conversion.
 
Hi
you want to get a range (which is an object) For object assignments you
nee set.
e.g. the following won't work:
dim rng as range
rng = range ("A1:A2")

but the following will
dim rng as range
set rng = range ("A1:A2")

--
Regards
Frank Kabel
Frankfurt, Germany

"y" schrieb im Newsbeitrag
...
Hi Frank,

thanks for your tips.

Just a question:

why Set aralik = Application.Inp... ? and not aralik =

Application.Inp...

Alex.





All times are GMT +1. The time now is 06:46 AM.

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