ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   New to Error Handleing (https://www.excelbanter.com/excel-programming/301073-new-error-handleing.html)

pkohler[_5_]

New to Error Handleing
 
I am trying to write a macro to remove duplicate records from a cs
file. The problem that I am having is that I am trying to allow th
user to select a range via an input box:

dim check as range

Set check = Application.InputBox(prompt:="Select with the Mouse th
Area you would like to check for Duplicates.", Type:=8)

That works fine, but If the user hit's cancel then the the macro error
out with a runtime error 424 Object required.

Any Recomendations

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

New to Error Handleing
 
Of course.

Dim Check As Range

On Error Resume Next
Set Check = Application.InputBox(prompt:="Select with the Mouse the Area you
would like to check for Duplicates.", Type:=8)
On Error Goto 0
If Not Check Is Nothing Then
'your codeEnd If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"pkohler " wrote in message
...
I am trying to write a macro to remove duplicate records from a csv
file. The problem that I am having is that I am trying to allow the
user to select a range via an input box:

dim check as range

Set check = Application.InputBox(prompt:="Select with the Mouse the
Area you would like to check for Duplicates.", Type:=8)

That works fine, but If the user hit's cancel then the the macro errors
out with a runtime error 424 Object required.

Any Recomendations?


---
Message posted from http://www.ExcelForum.com/




pkohler[_6_]

New to Error Handleing
 
Thanks for that tip, it worked great! However I am running into a ne
problem. Sometimes, Mouse entry stops working. I.E. when you try t
click on the range, it doesn't let you. You can still type in a rang
though. It is seemingly random and when it happens you either need t
restart excel or restart your computer. Has anyone ever seen this

--
Message posted from http://www.ExcelForum.com



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

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