VBA macro for copying cells from one sheet and pasting to another

wberg82

New Member
Joined
Feb 19, 2016
Messages
38
Sub Tapcon_134()
'
' Add_Fastener Macro
'
Sheets("Hardware Load List").Range("C" & Rows.Count).End(xlUp).Offset(1).Resize(, 6).Value = Range("B9,D9,E9:F9,G9:H9").Value
End Sub

The above macro is only taking the value is B9 and copying it across all cells in "Hardware Load list". I want to copy the entire selected Range and paste whatever is in those cells to the "Hardware Load List" sheet. The Range that is to be copied in sheet called "Fasteners". I want the range to be pasted to the next available row in the "Hardware Load List" which I believe this macro is already setup to do.

Need help copying all data in selected Range.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You cannot copy non-contiguous values like that, try
Code:
With Sheets("Hardware Load List").Range("C" & Rows.Count).End(xlUp).Offset(1)
   .Offset(, 1).Resize(, 5).Value = Range("D9:H9").Value
   .Value = Range("B9").Value
End With
 
Upvote 0
You cannot copy values of non-contiguous cells, in one go, so you need to do it for each range.
The With statement is just a short cut to save doing
Code:
Sheets("Hardware Load List").Range("C" & Rows.Count).End(xlUp).Offset(1, 1).Resize(, 5).Value = Range("D9:H9").Value
Sheets("Hardware Load List").Range("C" & Rows.Count).End(xlUp).Offset(1).Value = Range("B9").Value
 
Upvote 0
I would like to add a 3rd set of Values. This range is taken from J11. However, When adding this Range to the above formula, the result on sheet "Hardware Load List" is #N/A. How do I get this to return the value in Range J11 and not #N/A?
 
Upvote 0
How about
Code:
With Sheets("Hardware Load List").Range("C" & Rows.Count).End(xlUp).Offset(1)
   .Offset(, 1).Resize(, 5).Value = Range("D9:H9").Value
   .Offset(, 6).Value = Range("J11").Value
   .Value = Range("B9").Value
End With
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top