Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Microsoft Excel VB Macro Help!

$
0
0

Hi all,

I am currently working on a basic Stock Control sheet where the current stock is on one sheet and then there is another sheet for re-ordering stock. What I need to happen is when I click a button at the end of the row it copies certain cells from this sheet over to the next available row on the other sheet whilst also taking the value down in cell M8 by 1 (I haven't added this bit in yet but need help in doing so please!)

My Code is below for what I have but it keeps adding it into row 8 on the re-order sheet instead of adding it in the next available row if row 8 is already in use? Can someone help please?!?

Sub NewOrderRow8()
'
' NewOrderRow8 Macro
'

'
response = MsgBox("Are You Sure You Want To Add This To The Order List?", vbYesNo)
If response = vbNo Then
   ' MsgBox ("Macro Ending")
    Exit Sub
End If
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet

Set copySheet = Worksheets("Inventory Control")
Set pasteSheet = Worksheets("Re-Order Sheet")

copySheet.Range("B8:D8,G8:I8").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 2).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Many Thanks!

Daniel


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>