Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default error handling message help

Hi there,

I have a macro which enables users to import values into a master log. Each
row inserted into the master log has a unique date.
Question:
I'd like to add some code in which Excel loops through the existing rows in
the master sheet and checks that the date to be inserted doesn't already
exist. if it does exist, display a message which enables the user to
overwrite the existing entry or cancel the import process.

Ideas?

--
Carlee
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default error handling message help

Hi Carlee -

Here's some code to test in your application. It assumes your MasterLog
data range begins in A1 and the date is in column(1). Adjust to suit.

Sub Carlee()
Const d = "5/19/07"

Set dataRng = Range("A1").CurrentRegion
If Not dataRng.Columns(1).Find(d, LookIn:=xlValues, _
lookat:=xlWhole) Is Nothing Then
If MsgBox("Date already exists in MasterLog." & Chr(13) & _
"Press OK to overwrite or CANCEL.", vbOKCancel) = vbOK Then
'Call your code to insert the record, but overwrite instead
MsgBox "Overwriting..."
Else
MsgBox "Canceled; no overwrite..."
End If
End If
End Sub
---
Jay


"Carlee" wrote:

Hi there,

I have a macro which enables users to import values into a master log. Each
row inserted into the master log has a unique date.
Question:
I'd like to add some code in which Excel loops through the existing rows in
the master sheet and checks that the date to be inserted doesn't already
exist. if it does exist, display a message which enables the user to
overwrite the existing entry or cancel the import process.

Ideas?

--
Carlee

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error message handling #N/A Mifty Excel Discussion (Misc queries) 2 May 11th 08 04:54 PM
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Error handling. Francis Brown Excel Programming 3 December 1st 05 12:47 AM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM
error handling jeffP Excel Programming 1 July 3rd 04 06:10 PM


All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"