still learning
Well-known Member
- Joined
- Jan 15, 2010
- Messages
- 784
- Office Version
- 365
- Platform
- Windows
Hi
Hope all your loved ones are safe
This event code works except for when it tries to copy from the cell above
It gives me an error and wants me to debug
I put notes in to show what I’m trying to do
mike
Hope all your loved ones are safe
This event code works except for when it tries to copy from the cell above
It gives me an error and wants me to debug
VBA Code:
ActiveCell.Offset(-1, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long
' enter date in A move 2 cells to right
If Not Intersect(Target, Range("a40:a300")) Is Nothing Then
Target.Offset(0, 2).Select
End If
' enter date in C move 2 cells to right
If Not Intersect(Target, Range("c50:c600")) Is Nothing Then
Target.Offset(0, 2).Select
End If
' enter start reading in E move 1 cell to righ
If Not Intersect(Target, Range("e40:e300")) Is Nothing Then
Target.Offset(0, 1).Select
End If
' enter end date in F move 3 cells to right
If Not Intersect(Target, Range("f40:f600")) Is Nothing Then
Target.Offset(0, 3).Select
End If
' enter amount in I and go back to a and drop one line
If Not Intersect(Target, Range("i40:i300")) Is Nothing Then
Target.Offset(1, -8).Select
End If
' copy from 1 cell above
'ActiveCell.Offset(-1, 0).Range("A1").Select
' Application.CutCopyMode = False
' Selection.Copy
' ActiveCell.Offset(1, 0).Range("A1").Select
' ActiveSheet.Paste
' enter date in A move 2 cells to right
If Not Intersect(Target, Range("a40:a300")) Is Nothing Then
Target.Offset(0, 2).Select
End If
' enter date in C move 2 cells to right
If Not Intersect(Target, Range("c40:c600")) Is Nothing Then
Target.Offset(0, 2).Select
End If
' copy from 1 cell above
'ActiveCell.Offset(-1, 0).Range("A1").Select
'Application.CutCopyMode = False
' Selection.Copy
' ActiveCell.Offset(1, 0).Range("A1").Select
' ActiveSheet.Paste
' enter start reading in E move 1 cell to right
If Not Intersect(Target, Range("e40:e300")) Is Nothing Then
Target.Offset(0, 1).Select
End If
' enter end date in F move 3 cells to right
If Not Intersect(Target, Range("f40:f600")) Is Nothing Then
Target.Offset(0, 3).Select
End If
' enter amount in I and go back to a and drop one line
If Not Intersect(Target, Range("i40:i300")) Is Nothing Then
Target.Offset(1, -8).Select
End If
‘ that will end any data entry
End Sub
mike