View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default ByVal Target Range Great Code but need Help

Try:

Incoroprated some of Bernie's better code!

Private Sub Worksheet_Change(ByVal Target As Range)

Const WS_RANGE As String = "B1:B100"


On Error GoTo ws_exit:
Application.EnableEvents = False
If Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Or _
IsEmpty(Target) Or _
Not IsNumeric(Target) Then
GoTo ws_exit
End If
If MsgBox("Use the new value " & Target & _
" as new Daily Entry?", vbYesNo + vbDefaultButton1 _
+ vbInformation, "Verify Entry") < vbYes Then
Target.ClearContents
GoTo ws_exit
End If

Target.Resize(1, 3).Cut Target.Offset(0, 1)



ws_exit:
Application.EnableEvents = True
End Sub

"Mark" wrote:

Topper formula starts working down the line then quits working. When I go
back up to B# it doesn't ask "Yes" just stops.

Very close. I thought you had it...something stopped


"Toppers" wrote:

try:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B1:B100"


On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
If IsEmpty(Target) Or _
Not IsNumeric(Target) Then
Exit Sub
End If
If MsgBox("Use the new value " & Target & _
" as new Daily Entry?", vbYesNo + vbDefaultButton1 _
+ vbInformation, "Verify Entry") < vbYes Then
Target.ClearContents
Exit Sub
End If
Row = Target.Row
Range("c" & Row).Resize(1, 2).Copy Range("d" & Row)
'overwrite C3 with B3
Range("C" & Row) = Target
'clear B3 for tomorrow
Target.ClearContents

End If
ws_exit:
Application.EnableEvents = True
End Sub

"Mark" wrote:

I am getting help, yet I need further help. The formula I post below, works
for B3 and to the right. I need it to work exactly the same from B3 thru B100
and have numbers in the entire row work as B3 does . That is B49 moves to
C49, C49 moves to D49 etc.

Do I need a code for each line? That would seem horribly wrong.
Thank you: Check this. Works great for one line B3. It's a great code

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$B$3" Or _
IsEmpty(Target) Or _
Not IsNumeric(Target) Then
Exit Sub
End If
If MsgBox("Use the new value " & Target & _
" as new Daily Entry?", vbYesNo + vbDefaultButton1 _
+ vbInformation, "Verify Entry") < vbYes Then
Target.ClearContents
Exit Sub
End If
'overwrite E3 with D3
Range("E3") = Range("D3")
'overwrite D3 with C3
Range("D3") = Range("C3")
'overwrite C3 with B3
Range("C3") = Target
'clear B3 for tomorrow
Target.ClearContents
End Sub

Need B1:B100 to work this way