LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default How to trigger MsgBox for this event?

I have the following code which copies a range from one worksheet to another,
both within the same workbook. If there is a duplicate date it copies over
the date, if new date it copies to the next available cell.

Dim rCell As Range
Dim rFound As Range
With Application.ThisWorkbook
Set rFound =
..Worksheets("Data").Columns("B").Find(What:=(.Wor ksheets("STD Calc") _
.Range("C6")), LookAt:=xlWhole, LookIn:=xlFormulas)
If rFound Is Nothing Then
Set rCell =
..Worksheets("Data").Range("A65536").End(xlUp).Off set(1, 0)
Else
Set rCell = rFound.Offset(-3, -1)
End If
Worksheets("STD Calc").Range("B17:Q37").Copy
rCell.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End With
Dim RetVal As Variant
RetVal = Application.GetSaveAsFilename(Range("C2"))

If RetVal < False Then
ThisWorkbook.SaveAs RetVal & "xls"

End If

This copies two weeks of data at a time. on the 12th week or 6th iteration,
a maximum is reached. I want at that point to cause a MsgBox to pop up
indicating can't use the form go to form blah, blah.... and on OK the user
form is closed.

I think I know how to do the MsgBox itself. My question is how do I trigger
the MsgBox to appear? I know the cell in the worksheet where data is being
copied to that would represent the maximum. Would that be the place that
triggers the MsgBox? If so, how do I accomplish that?

As always thanks so much for your help!!!!


 
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
MsgBox in Enter event causes combobox not to run Change event Richard Excel Programming 0 March 6th 06 02:52 PM
Event Trigger lobo Excel Programming 5 December 16th 05 08:33 PM
Trigger Event Code Shawn Excel Programming 2 July 14th 05 02:33 PM
trigger an EVENT when the value in a cell changes? Controls Freak Excel Programming 1 December 21st 04 07:24 AM
Trigger Event Todd Huttenstine Excel Programming 2 July 14th 04 06:50 PM


All times are GMT +1. The time now is 11:54 AM.

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"