TimClayton
New Member
- Joined
- Oct 17, 2018
- Messages
- 11
Hi all
I can't seem to find the right code for what I want to do. I've designed a very basic POS type system in excel for our shop:
When a stock number is typed into column A, column B,C,D & E are populated using Index & Match formula.
When I press the cash/card/cheque button, Excel copies the information and pastes it in another sheet, then resets the form.
This all works perfectly. However, what I also want to happen when the buttons are pressed is for Excel to copy the date and time at the top, search for all the stock numbers in column A in the "Stock" sheet, and paste it into column I (Date Sold) of all the relevant cells.
I have no idea how to even start this. Below is the current code for the button. It's not pretty, but it does the job:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub CASH()
Range("F19").Select
ActiveCell.FormulaR1C1 = "CASH"
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Sale")
Set pasteSheet = Worksheets("Sales")
copySheet.Range("A1:F20").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(3, 0).PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(-19, 0).PasteSpecial
Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Application.ScreenUpdating = True
Application.Goto Reference:="Default"
Selection.Copy
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
End Sub
</code>Any help would be greatly appreciated!
I can't seem to find the right code for what I want to do. I've designed a very basic POS type system in excel for our shop:
When a stock number is typed into column A, column B,C,D & E are populated using Index & Match formula.
When I press the cash/card/cheque button, Excel copies the information and pastes it in another sheet, then resets the form.
This all works perfectly. However, what I also want to happen when the buttons are pressed is for Excel to copy the date and time at the top, search for all the stock numbers in column A in the "Stock" sheet, and paste it into column I (Date Sold) of all the relevant cells.
I have no idea how to even start this. Below is the current code for the button. It's not pretty, but it does the job:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub CASH()
Range("F19").Select
ActiveCell.FormulaR1C1 = "CASH"
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Sale")
Set pasteSheet = Worksheets("Sales")
copySheet.Range("A1:F20").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(3, 0).PasteSpecial
Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(-19, 0).PasteSpecial
Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Application.ScreenUpdating = True
Application.Goto Reference:="Default"
Selection.Copy
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
End Sub
</code>Any help would be greatly appreciated!