Add values to different sheets (vba)
Could you please show me the code to place the copied data into a different tab instead of below the input cells. Its annoying me and I'm rubbish at this. thanks.
Answer:
Create drop down list
- Go to tab "Data"
- Click "Data Validation" button
- Go to "Settings" tab
- Select List
- Type 2011, 2012 (sheet names) in Source:
- Click OK
Macro code
- Press Alt+ F11
- Right click your workbook in project explorer
- Click Insert
- Click Module
- Paste macro code below to module
- Exit VB Editor
Sub AddValues()
Dim i As Single
i = Worksheets("" & Range("D2")).Range("A" & Rows.Count).End(xlUp).Row + 1
Worksheets("" & Range("D2")).Range("A" & i & ":C" & i) = _
Worksheets("Enter Data").Range("A2:C2").Value
Worksheets("Enter Data").Range("A2:C2") = ""
End Sub
Create button
- Go to "Developer" tab
- Click "Insert" button
- Click "Button" (form control)
- Assign macro AddValues()
- Click OK
Download excel file *.xlsm
Add values to different sheets.xlsm
Related posts:
Create links to all sheets in a workbook

















