VBA for next column over

robertdseals

Active Member
Joined
May 14, 2008
Messages
334
Office Version
  1. 2010
Platform
  1. Windows
OK, last question of the day. I have this VBA

Sub Macro6()
' Macro6 Macro


Sheets("Sheet7").Select
Range("B5:C40").Select
Selection.Copy
Sheets("Sheet9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("Qr2:Qr56").Select
For Each xCell In Selection
xCell.Value = CDec(xCell.Value)
Next xCell
End Sub

This copies data from two columns in sheet7 and paste them into sheet9. I paste them into the active cell. My problem is in this section:
Range("Qr2:Qr56").Select
For Each xCell In Selection
xCell.Value = CDec(xCell.Value)
Next xCell

I don't always want to select range QR. I want to select the 2nd column of where ever I pasted my data.
Thoughts?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I think I've done it....
Sub Macro6()
'
' Macro6 Macro
'


'
Sheets("Sheet7").Select
Range("B5:C40").Select
Selection.Copy
Sheets("Sheet9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Select
Do While Not IsEmpty(ActiveCell)


For Each xCell In Selection
xCell.Value = CDec(xCell.Value)
Next xCell
ActiveCell.Offset(1, 0).Select
Loop


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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