Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code used in data entry. I use it in several insatnces
and have no problems. However, in this configuration, it will, after 4 rows, prompt for a response to the overwriting data test even though there is no data in the target cells. I can skip a few lines and start re-entering and after 4 lines it asks the over writie prompt again. In other workbooks (different purpose/design) it will go forever if there is no data to over write. The only thing I've added is "ActiveCell.Offset(0, 4).Value = "Y"" to create a default, and changed the starting rows etc to fit the new form demension. Anyone with any ideas? Private Sub Worksheet_Change(ByVal target As Range) If target.Cells.Count 1 Then Exit Sub If target.Column < 6 Then Exit Sub 'last data entry cell If target.Row < 19 Then Exit Sub 'starting row If target.Offset(0, 1).Value < "" Then If MsgBox("You are overwrititng existing data. Are you sure?", vbYesNo) = vbNo Then Application.EnableEvents = False Application.Undo Application.EnableEvents = True Exit Sub End If End If Application.EnableEvents = False Cells(target.Row + 1, 1).Select 'MsgBox "Range" & target.Address & "was changed" Range("g19:Q19").Copy target.Offset(0, 1).Resize(1, 8) 'formula row to copy ActiveCell.Offset(0, 4).Value = "Y" Application.EnableEvents = True End Sub -- Jim |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? | Excel Programming | |||
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does | Excel Programming | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
Excel code convert to Access code - Concat & eliminate duplicates | Excel Programming |