Solved

Exclude certain columns from being copied

Posted on 2012-03-20
1
155 Views
Last Modified: 2012-06-27
I'm using this code to copy data to a new worksheet.

Is it possible to exclude certain columns, say the 15th column?

For Each r In rngDb
   rngOut.Offset(i).Value = r.Resize(, 24).Value
   i = i + 1     
Next r

Open in new window

0
Comment
Question by:mcnuttlaw
1 Comment
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 37741791
You would have to loop through the cells rather than using resize, or perform the action in two blocks:

For Each r In rngDb
   with rngOut.Offset(i)
       .resize(, 14).Value = r.Resize(, 14).Value
       .offset(, 15).resize(, 8).value = r.offset(, 15).Resize(, 8).value
   End With
   i = i + 1     
Next r

Open in new window


Note: this assumes you leave a gap in the range you copy to; if you don't want that, then the first offset should be by 14 not 15.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now