Copy&Paste from multiple ranges a consolidated range

Xceller

Active Member
Joined
Aug 24, 2009
Messages
265
I am trying to copy mulitple ranges from an Input sheet to a consolidated range in a Report sheet. There's some blank row in between multiple ranges that I don't want to copy(Row 21 to Row 23). The following code copies everything over to the report sheet. Appreciate your help in advance.

Dim WSI As Worksheet
Dim WSR As Worksheet

Set WSI = Worksheets("Input")
Set WSR = Worksheets("Report")

FinalRow = Sheets("Report").Cells(Rows.Count, 1).End(xlUp).Row

WSR.Cells(FinalRow + 1, 1).Resize(17, 1).Value = WSI.Range("C14:C20", "C24:C30").Value
WSR.Cells(FinalRow + 1, 2).Resize(17, 1).Value = WSI.Range("O14:O20", "O24:O30").Value
WSR.Cells(FinalRow + 1, 3).Resize(17, 1).Value = WSI.Range("S14:S20", "S24:S30").Value
WSR.Cells(FinalRow + 1, 4).Resize(17, 1).Value = WSI.Range("T14:T20", "T24:T30").Value
WSR.Cells(FinalRow + 1, 5).Resize(17, 1).Value = WSI.Range("U14:U20","U24:U30").Value
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Code:
WSI.Range("C14:C20,C24:C30").Copy WSR.Cells(FinalRow + 1, 1)
 
Upvote 0
Thanks for your help. Can you take a look at my codes below, I cannot figure out what is wrong.

Sub copyNpaste()

Dim WSI As Worksheet
Dim WSD As Worksheet


Set WSI = Worksheets("Input")
Set WSD = Worksheets("dBASE")


FinalRow = Sheets("dBASE").Cells(Rows.Count, 1).End(xlUp).Row
dRange = Sheets("dBASE").Range("A2").Resize(FinalRow - 1, 1)
CurrentDate = Sheets("Input").Range("E5").Value

For Each cell In dRange
If cell.Value = CurrentDate Then
MsgBox ("Data already exist in database")
Exit Sub
End If
Next cell

WSD.Cells(FinalRow + 1, 1).Resize(7, 1).Value = WSI.Range("C14:C20").Value
WSD.Cells(FinalRow + 8, 1).Resize(7, 1).Value = WSI.Range("C24:C30").Value

WSD.Cells(FinalRow + 1, 2).Resize(7, 1).Value = WSI.Range("O14:O20").Value
WSD.Cells(FinalRow + 8, 2).Resize(7, 1).Value = WSI.Range("O24:O30").Value

WSD.Cells(FinalRow + 1, 3).Resize(7, 1).Value = WSI.Range("S14:S20").Value
WSD.Cells(FinalRow + 8, 3).Resize(7, 1).Value = WSI.Range("S24:S30").Value

WSD.Cells(FinalRow + 1, 4).Resize(7, 1).Value = WSI.Range("T14:T20").Value
WSD.Cells(FinalRow + 8, 4).Resize(7, 1).Value = WSI.Range("T24:T30").Value

WSD.Cells(FinalRow + 1, 5).Resize(7, 1).Value = WSI.Range("U14:U20").Value
WSD.Cells(FinalRow + 8, 5).Resize(7, 1).Value = WSI.Range("U24:U30").Value

End Sub
 
Upvote 0
What is it doing or not doing?
What should it do?

The title of your post here says "Copy&Paste".
You do know you're are not copying and pasting.

At quick glance the last solution I proposed
should work I think.

Try:
Code:
WSI.Range("C14:C20").Copy WSD.Cells(FinalRow + 1, 1)
Repeat for all WSI ranges.
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,911
Members
452,949
Latest member
beartooth91

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