simple range selection

shadow12345

Well-known Member
Joined
May 10, 2004
Messages
1,238
Hi all,

Am I trying to select the values in:

B1 to D1 in the first blank cell in Col H
A3 to C5 and copy them into the first blank cell in Col I (B and C values will then go in J&K)

Thats it really, it should eventually build up into a pretty useful tool.

I have been trying to do it an got this far if its help.

Code:
Sub reporting()

Dim lasthCell As Range
Set lasthCell = Range("H" & Rows.Count).End(xlUp).Offset(1)

Range("B1:D1").Select
Selection.Copy

lasthCell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False


Range("A3:C5").Select
Selection.Copy
lasthCell.Offset(0, 1).Select
ActiveSheet.Paste



End Sub


<table border = "1" cellspacing = "0" bordercolor="#999999">
<tr><td bgcolor="#C0C0C0"> </td>
<td align="center" bgcolor="#C0C0C0"><b>A</b></td><td align="center" bgcolor="#C0C0C0"><b>B</b></td><td align="center" bgcolor="#C0C0C0"><b>C</b></td><td align="center" bgcolor="#C0C0C0"><b>D</b></td><td align="center" bgcolor="#C0C0C0"><b>E</b></td><td align="center" bgcolor="#C0C0C0"><b>F</b></td><td align="center" bgcolor="#C0C0C0"><b>G</b></td><td align="center" bgcolor="#C0C0C0"><b>H</b></td><td align="center" bgcolor="#C0C0C0"><b>I</b></td><td align="center" bgcolor="#C0C0C0"><b>J</b></td><td align="center" bgcolor="#C0C0C0"><b>K</b></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>1</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">This Week </font></td><td rowspan="1" colspan="3" width="288" height="30" align = "center" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">29 August to 02 September </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Week On Week </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>2</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Shar </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Member </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Ratio </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Date </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Comodity </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Member </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Ratio </font></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>3</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Mr </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">660.5714 </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>4</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Mrs </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">246.8608 </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>5</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">John </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">163.942 </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td></tr>
</table>

Should end up like this
<table border = "1" cellspacing = "0" bordercolor="#999999">
<tr><td bgcolor="#C0C0C0"> </td>
<td align="center" bgcolor="#C0C0C0"><b>A</b></td><td align="center" bgcolor="#C0C0C0"><b>B</b></td><td align="center" bgcolor="#C0C0C0"><b>C</b></td><td align="center" bgcolor="#C0C0C0"><b>D</b></td><td align="center" bgcolor="#C0C0C0"><b>E</b></td><td align="center" bgcolor="#C0C0C0"><b>F</b></td><td align="center" bgcolor="#C0C0C0"><b>G</b></td><td align="center" bgcolor="#C0C0C0"><b>H</b></td><td align="center" bgcolor="#C0C0C0"><b>I</b></td><td align="center" bgcolor="#C0C0C0"><b>J</b></td><td align="center" bgcolor="#C0C0C0"><b>K</b></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>1</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">This Week </font></td><td rowspan="1" colspan="3" width="288" height="30" align = "center" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">29 August to 02 September </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="262.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Week On Week </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>2</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Shar </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Member </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Ratio </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="262.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Date </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Comodity </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Member </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Ratio </font></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>3</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Mr </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">660.5714 </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="262.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">29 August to 02 September </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Mr </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">660.5714 </font></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>4</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Mrs </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">246.8608 </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="262.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">29 August to 02 September </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Mrs </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">246.8608 </font></td></tr>
<tr><td align = "center" bgcolor="#C0C0C0"><b>5</b></td><td rowspan="1" colspan="1" width="106.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">John </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">163.942 </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000"> </font></td><td rowspan="1" colspan="1" width="262.5" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">29 August to 02 September </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">Apple </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "left" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">John </font></td><td rowspan="1" colspan="1" width="96" height="30" align = "right" valign = "bottom" bgcolor ="#FFFFFF"><font color="#000000">163.942 </font></td></tr>
</table>
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Maybe something like
Code:
Sub reporting()
Dim lasthCell As Range
Set lasthCell = Range("H" & Rows.Count).End(xlUp)
Range("B1:D1").Copy
lasthCell.Offset(1, 1).PasteSpecial Paste:=xlPasteValues
Range("A3:C5").Copy
lasthCell.Offset(2, 1).Select
ActiveSheet.Paste
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,683
Members
452,938
Latest member
babeneker

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