ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Can Save be added to this! (https://www.excelbanter.com/excel-worksheet-functions/131365-can-save-added.html)

Bob[_2_]

Can Save be added to this!
 

Can Cntrl-S be added to this script so each time it will save as well?
Thanks for any help...Bob
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NextRow As Long
If Target.Address = "$E$162" Then

With Sheets("ChequesOut")

If .Range("C1").Value = "" Then
NextRow = 1
Else
NextRow = .Range("C" & Rows.Count).End(xlUp).Offset(1,
0).Row
End If

Me.Range("b162,E162").Copy _
Destination:=.Cells(NextRow, "C")

With .Cells(NextRow, "A")
.Value = Now 'date ???
.NumberFormat = "dd/mmm/yy " 'dd/mm/yyyy ????
End With

End With

Me.Range("B162").Select
End If
End Sub



Jim Thomlinson

Can Save be added to this!
 
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NextRow As Long
If Target.Address = "$E$162" Then

With Sheets("ChequesOut")

If .Range("C1").Value = "" Then
NextRow = 1
Else
NextRow = .Range("C" & Rows.Count).End(xlUp).Offset(1,
0).Row
End If

Me.Range("b162,E162").Copy _
Destination:=.Cells(NextRow, "C")

With .Cells(NextRow, "A")
.Value = Now 'date ???
.NumberFormat = "dd/mmm/yy " 'dd/mm/yyyy ????
End With

End With

Me.Range("B162").Select
thisworkbook.Save '*****
End If
End Sub
--
HTH...

Jim Thomlinson


"Bob" wrote:


Can Cntrl-S be added to this script so each time it will save as well?
Thanks for any help...Bob
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NextRow As Long
If Target.Address = "$E$162" Then

With Sheets("ChequesOut")

If .Range("C1").Value = "" Then
NextRow = 1
Else
NextRow = .Range("C" & Rows.Count).End(xlUp).Offset(1,
0).Row
End If

Me.Range("b162,E162").Copy _
Destination:=.Cells(NextRow, "C")

With .Cells(NextRow, "A")
.Value = Now 'date ???
.NumberFormat = "dd/mmm/yy " 'dd/mm/yyyy ????
End With

End With

Me.Range("B162").Select
End If
End Sub




Bob[_2_]

Can Save be added to this!
 
Jim the name of the workbook is Cheques but I am getting a compile error on
Cheques.Save
Thanks Bob
"Jim Thomlinson" wrote in message
...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NextRow As Long
If Target.Address = "$E$162" Then

With Sheets("ChequesOut")

If .Range("C1").Value = "" Then
NextRow = 1
Else
NextRow = .Range("C" & Rows.Count).End(xlUp).Offset(1,
0).Row
End If

Me.Range("b162,E162").Copy _
Destination:=.Cells(NextRow, "C")

With .Cells(NextRow, "A")
.Value = Now 'date ???
.NumberFormat = "dd/mmm/yy " 'dd/mm/yyyy ????
End With

End With

Me.Range("B162").Select
thisworkbook.Save '*****
End If
End Sub
--
HTH...

Jim Thomlinson


"Bob" wrote:


Can Cntrl-S be added to this script so each time it will save as well?
Thanks for any help...Bob
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NextRow As Long
If Target.Address = "$E$162" Then

With Sheets("ChequesOut")

If .Range("C1").Value = "" Then
NextRow = 1
Else
NextRow = .Range("C" & Rows.Count).End(xlUp).Offset(1,
0).Row
End If

Me.Range("b162,E162").Copy _
Destination:=.Cells(NextRow, "C")

With .Cells(NextRow, "A")
.Value = Now 'date ???
.NumberFormat = "dd/mmm/yy " 'dd/mm/yyyy ????
End With

End With

Me.Range("B162").Select
End If
End Sub






Bob[_2_]

Can Save be added to this!
 
Oops sorry didn't actually need the name, fine now. Thanks
"Bob" wrote in message ...
Jim the name of the workbook is Cheques but I am getting a compile error
on Cheques.Save
Thanks Bob
"Jim Thomlinson" wrote in
message ...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NextRow As Long
If Target.Address = "$E$162" Then

With Sheets("ChequesOut")

If .Range("C1").Value = "" Then
NextRow = 1
Else
NextRow = .Range("C" & Rows.Count).End(xlUp).Offset(1,
0).Row
End If

Me.Range("b162,E162").Copy _
Destination:=.Cells(NextRow, "C")

With .Cells(NextRow, "A")
.Value = Now 'date ???
.NumberFormat = "dd/mmm/yy " 'dd/mm/yyyy ????
End With

End With

Me.Range("B162").Select
thisworkbook.Save '*****
End If
End Sub
--
HTH...

Jim Thomlinson


"Bob" wrote:


Can Cntrl-S be added to this script so each time it will save as well?
Thanks for any help...Bob
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NextRow As Long
If Target.Address = "$E$162" Then

With Sheets("ChequesOut")

If .Range("C1").Value = "" Then
NextRow = 1
Else
NextRow = .Range("C" & Rows.Count).End(xlUp).Offset(1,
0).Row
End If

Me.Range("b162,E162").Copy _
Destination:=.Cells(NextRow, "C")

With .Cells(NextRow, "A")
.Value = Now 'date ???
.NumberFormat = "dd/mmm/yy " 'dd/mm/yyyy ????
End With

End With

Me.Range("B162").Select
End If
End Sub









All times are GMT +1. The time now is 09:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com