Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default ByVal Target Range Great Code but need Help

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default ByVal Target Range Great Code but need Help

Mark,

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1:B100")) Is Nothing Or _
IsEmpty(Target) Or _
Not IsNumeric(Target) Or _
Target.Cells.Count 1 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 old values
Application.EnableEvents = False
Target.Resize(1, 3).Cut Target.Offset(0, 1)
Application.EnableEvents = True

End Sub


HTH,
Bernie
MS Excel MVP


"Mark" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default ByVal Target Range Great Code but need Help

Sorry it didn't work : The code I have works acrros B3

It did not work in any cell between B4:b100

Your assistance is hugely appreciated

Mark

"Bernie Deitrick" wrote:

Mark,

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1:B100")) Is Nothing Or _
IsEmpty(Target) Or _
Not IsNumeric(Target) Or _
Target.Cells.Count 1 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 old values
Application.EnableEvents = False
Target.Resize(1, 3).Cut Target.Offset(0, 1)
Application.EnableEvents = True

End Sub


HTH,
Bernie
MS Excel MVP


"Mark" wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default ByVal Target Range Great Code but need Help

Sorry it didn't work : The code I have works acrros B3

It did not work in any cell between B4:b100


It does work, on every cell in the range B1:B100, as long as

1) you enter a value into a single cell
2) you enter a number

If you want to lift the single cell restriction, then remove


Or _
Target.Cells.Count 1

HTH,
Bernie
MS Excel MVP


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default ByVal Target Range Great Code but need Help

I enter a number in B3 sometimes down to B100

I need that # to go to C3, I need C3 to overide D3 and D3 ro overide e3,
basically continue to track the last 3 entries.

My formula only works for B3

Additional info F3 is =average(C3:E3)

"Bernie Deitrick" wrote:

Sorry it didn't work : The code I have works acrros B3

It did not work in any cell between B4:b100


It does work, on every cell in the range B1:B100, as long as

1) you enter a value into a single cell
2) you enter a number

If you want to lift the single cell restriction, then remove


Or _
Target.Cells.Count 1

HTH,
Bernie
MS Excel MVP





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default ByVal Target Range Great Code but need Help

If you mean that whatever is entered in a cell in B1:B100 get put onto row 3 only, then you could
replace

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

with

Target.Copy
Range("C3").Insert Shift:=xlToRight
Range("F3").Clear 'This is optional
Target.Clear

HTH,
Bernie
MS Excel MVP


"Mark" wrote in message
...
I enter a number in B3 sometimes down to B100

I need that # to go to C3, I need C3 to overide D3 and D3 ro overide e3,
basically continue to track the last 3 entries.

My formula only works for B3

Additional info F3 is =average(C3:E3)

"Bernie Deitrick" wrote:

Sorry it didn't work : The code I have works acrros B3

It did not work in any cell between B4:b100


It does work, on every cell in the range B1:B100, as long as

1) you enter a value into a single cell
2) you enter a number

If you want to lift the single cell restriction, then remove


Or _
Target.Cells.Count 1

HTH,
Bernie
MS Excel MVP





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

try changing:

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

to

Target.Resize(1, 3).Copy Target.Offset(0, 1)
Target.ClearContents

HTH
"Mark" wrote:

I enter a number in B3 sometimes down to B100

I need that # to go to C3, I need C3 to overide D3 and D3 ro overide e3,
basically continue to track the last 3 entries.

My formula only works for B3

Additional info F3 is =average(C3:E3)

"Bernie Deitrick" wrote:

Sorry it didn't work : The code I have works acrros B3

It did not work in any cell between B4:b100


It does work, on every cell in the range B1:B100, as long as

1) you enter a value into a single cell
2) you enter a number

If you want to lift the single cell restriction, then remove


Or _
Target.Cells.Count 1

HTH,
Bernie
MS Excel MVP



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default ByVal Target Range Great Code but need Help

DANG! BERNIE!

If I could give you more than one Perfect rating I would Thank you, Thank
You, Thank You

Question. I have a duplicate of this on sheet 2:

Is there anyway to merger the 2 sheets. That is ,as if I would copy (sheet2)
From A1 to J100 and paste it into sheet 1 around L1? Can you run both on one
formula or must the entire thing be redone?

Thanks anyway fanfriggin tastic!

Mark

"Bernie Deitrick" wrote:

Sorry it didn't work : The code I have works acrros B3

It did not work in any cell between B4:b100


It does work, on every cell in the range B1:B100, as long as

1) you enter a value into a single cell
2) you enter a number

If you want to lift the single cell restriction, then remove


Or _
Target.Cells.Count 1

HTH,
Bernie
MS Excel MVP



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default ByVal Target Range Great Code but need Help

To execute another range:

change to:

Const WS_RANGE As String = "B1:B100, L1:L100"

Date must be ENTERED into L1:L100 as copy/paste doesn't invoke the code.

"Mark" wrote:

DANG! BERNIE!

If I could give you more than one Perfect rating I would Thank you, Thank
You, Thank You

Question. I have a duplicate of this on sheet 2:

Is there anyway to merger the 2 sheets. That is ,as if I would copy (sheet2)
From A1 to J100 and paste it into sheet 1 around L1? Can you run both on one
formula or must the entire thing be redone?

Thanks anyway fanfriggin tastic!

Mark

"Bernie Deitrick" wrote:

Sorry it didn't work : The code I have works acrros B3

It did not work in any cell between B4:b100


It does work, on every cell in the range B1:B100, as long as

1) you enter a value into a single cell
2) you enter a number

If you want to lift the single cell restriction, then remove


Or _
Target.Cells.Count 1

HTH,
Bernie
MS Excel MVP



  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default ByVal Target Range Great Code but need Help

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



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default ByVal Target Range Great Code but need Help

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

  #12   Report Post  
Posted to microsoft.public.excel.misc
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

  #13   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default ByVal Target Range Great Code but need Help

Perfect. I executed your code wrong. As I posted below. i would love to run 2
of these side by side on the same sheet devided by one column. Can it be done?

You guys are Fanatstic.

Mark

"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

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
Target cell reference moves when target is cut and pasted Illya Teideman Excel Discussion (Misc queries) 5 May 31st 07 11:34 AM
Private Sub Worksheet_Change(ByVal Target As Excel.Range) [email protected] Excel Worksheet Functions 0 December 21st 06 02:13 AM
Charting data points and show a target range on the same chart. Minireefkeeper Charts and Charting in Excel 6 February 18th 06 06:50 PM
Target cell=range?? alexsmalley Excel Discussion (Misc queries) 2 October 6th 05 04:49 PM
Displaying target range across the Y axis. Gary Clarke Charts and Charting in Excel 3 June 14th 05 01:16 PM


All times are GMT +1. The time now is 01:32 AM.

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

About Us

"It's about Microsoft Excel"