non-contiguous range issue

reneuend

Board Regular
Joined
May 20, 2009
Messages
155
I'm building a range using Excel VBA that needs to skip one column. The rest are contiguous.

The range is dynamic, but in my test run it equals "F13:M13,O13:O13".
When I look at the values in this range it is only showing the values for F13:M13. Why doesn't it show O13:O13?

Code:
sRange = sCol1 & sRow & ":" & sCol2 & sRow & "," & sCol3 & sRow & ":" & sCol3 & sRow
            
Set InputRngB = ActiveWorkbook.Worksheets(TEST_TAB).Range(sRange)


Thanks for replying!
 
Thanks Dean. I actually wasn't using the Copy / Paste option when I wrote my code. I had a "named range" the same size as the non-contiguous range that I created. Then I just set the named range equal to the non-contiguous range.

worksheets("mysheet").range("myrange").value = noncontiguous_range.value

Since this doesn't seem to work though, I'll review and learn how your code works.

I wonder why they haven't fixed this in the newer versions of Excel? It seems like something that would be a common issue.

much appreciated,
~reneuend
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,224,568
Messages
6,179,595
Members
452,927
Latest member
whitfieldcraig

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