ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying Macro help needed (https://www.excelbanter.com/excel-programming/313805-copying-macro-help-needed.html)

Rescueme[_2_]

Copying Macro help needed
 
Thanks in advance to any one that can help. Karen

I have a macro in a spreadsheet that works fine (copy below). I need a
similar Macro in the same workbook to SAVE_CONFIRMATION and
SET_CONFIRMATION. I have two new sheets in the workbook Confirmation (which
is the same as the invoice) and COWorksheet (which is the same idea as
INWorksheet). My Invoice sheet has a button at the bottom to Save Invoice, I
want to make a similar button on the bottom of my Confrimation sheet to Save
Confirmation but I can't seem to access the button that copied over to
change the wording etc. I have no problem changing the information that is
being saved by the Macro, but I am not able to get the new macro set up to
start, I had help with the initial setup of the first and the creation of
the Button to save it.

Public Sub SAVE_INVOICE()

'write invoice details to worksheet..
With ThisWorkbook.Worksheets("INWorksheet")
.Range("A" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("I1").Val ue
.Range("B" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("H13").Va lue 'Invoice Date
.Range("C" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("B11").Va lue 'Client Name
.Range("D" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("I44").Va lue 'Total
.Range("E" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("I41").Va lue 'SubTotal
.Range("F" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("I42").Va lue 'GST
.Range("G" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("I43").Va lue 'PST
.Range("H" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("A20").Va lue 'Shipping Date
.Range("I" & iROW).Value =
ThisWorkbook.Worksheets("Invoice").Range("G20").Va lue 'FOB Terms


End With
End Sub

Public Sub SET_INVOICE()
Dim iFlag As Integer 'counter
Dim iINVOICE_NO As Integer

'this code will auto - generate the next Invoice No. and put the detail
into 'INWORKSHEET'

'turn off screen updating so theres no flickering...
Application.ScreenUpdating = False

'first empty row = iROW
iROW =
Application.CountA(ThisWorkbook.Worksheets("INWork sheet").Range("A1:A60000"),
0)

'need to keep iROW, so assign value to iFlag
iFlag = iROW - 1

'now see if the entry in the last cell in Col A is numeric....loop until
you find a number...
Do Until IsNumeric(ThisWorkbook.Worksheets("INWorksheet").R ange("A" &
iFlag).Value)
iFlag = iFlag - 1
Loop

iINVOICE_NO = ThisWorkbook.Worksheets("INWorksheet").Range("A" &
iFlag).Value

'put the NEW invoice number into the Invoice
ThisWorkbook.Worksheets("Invoice").Range("I1").Val ue = iINVOICE_NO + 1

'default todays date on the invoice
ThisWorkbook.Worksheets("Invoice").Range("H13").Va lue = Date

'now turn screen updating back on to see results
Application.ScreenUpdating = True


End Sub




All times are GMT +1. The time now is 03:33 PM.

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