ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why is this an error? (https://www.excelbanter.com/excel-programming/376315-why-error.html)

davegb

Why is this an error?
 
The following code I copied from a book. But I always get the error
message when I select the data range in the refedit control and click
OK. Why is it never correct?

Private Sub OKButton_Click()
On Error Resume Next
Set rColHdr = Range(reDataStrt.Text)
If Error < 0 Then
MsgBox "Invalid range selection, please select the starting range
again."
On Error GoTo 0
Exit Sub
End If
uf1021Mid.Hide
End Sub

Thanks!


Doug Glancy

Why is this an error?
 
davegb,

Change "Error" to "Err" and I belive it will work.

hth,

Doug

"davegb" wrote in message
oups.com...
The following code I copied from a book. But I always get the error
message when I select the data range in the refedit control and click
OK. Why is it never correct?

Private Sub OKButton_Click()
On Error Resume Next
Set rColHdr = Range(reDataStrt.Text)
If Error < 0 Then
MsgBox "Invalid range selection, please select the starting range
again."
On Error GoTo 0
Exit Sub
End If
uf1021Mid.Hide
End Sub

Thanks!




davegb

Why is this an error?
 

Doug Glancy wrote:
davegb,

Change "Error" to "Err" and I belive it will work.

hth,

Doug


Thanks, Doug!

"davegb" wrote in message
oups.com...
The following code I copied from a book. But I always get the error
message when I select the data range in the refedit control and click
OK. Why is it never correct?

Private Sub OKButton_Click()
On Error Resume Next
Set rColHdr = Range(reDataStrt.Text)
If Error < 0 Then
MsgBox "Invalid range selection, please select the starting range
again."
On Error GoTo 0
Exit Sub
End If
uf1021Mid.Hide
End Sub

Thanks!




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

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