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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,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