Selecting nocontiguous columns

Mr_Ragweed

Board Regular
Joined
Dec 10, 2012
Messages
74
Hello and thanks in advance,
I am trying to select 2 noncontiguous columns. My code that doesn't work is below:

CODE STARTS HERE:
Activesheet.Range("A4:A" & FinalRow, "D4:D" & FinalRow).Select
Selection.Copy

END OF CODE.
What happens is that columns B and C get selected also.

I tried the following:
CODE STARTS HERE:
Range("A4,D4").EntireColumn.Select
Selection.Copy
END OF CODE

It actually selects the 2 columns i want but, as i told it to, selects the entire column instead of starting at A4 and D4 respectively.

I need some sort of FinalRow type statement because no 2 worksheets will be the same length and the number of sheets will also vary. However, the length of A and D will always be the same on the same sheet. (If any of that even matters.)
I also should point out that Column A is part of a Pivot Table and Column D is not (in case that matters as well.)
Thanks again!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Code:
[COLOR=#333333]Activesheet.Range("A4:A" & FinalRow & ", D4:D" & FinalRow).Select[/COLOR]

Try that. You were missing your comma in the text (if that was a direct copy from your code.)
 
Upvote 0

Forum statistics

Threads
1,216,116
Messages
6,128,933
Members
449,480
Latest member
yesitisasport

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