View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
[email protected] bstevens@rock.com is offline
external usenet poster
 
Posts: 23
Default How to paste to alternating columns?

On Oct 15, 10:26 am, "Don Guillett" wrote:
Fire this from the DESTINATION workbook

Sub gettablefromsource()
'copies
Workbooks("sourcebook.xls").Sheets("sheet1") _
.Columns("b5:g50").Copy Range("a1")

'inserts cols
For i = Cells(1, Columns.Count) _
.End(xlToLeft).Column To 2 Step -1
Columns(i).Insert
Next i
End Sub


Oh, gosh, I didn't know it was going to be like that. It would work,
but it doesn't approach the problem correctly.

1. The table that is being copied isn't always in b5:g50; it varies
from table to table. Setting a specific cell range in the code won't
work.

2. In the target table in Workbook 2, the "blank columns" in between
are actually pre-populated with a calculation formula that will
operate on the data in the pasted-in columns. So, what I'm going to
do is select 4 columns in a table in one workbook, with a varying
location and varying number of rows. Then I'll go to another workbook
and paste it into a pre-existing table which has 10 columns, and
columns c, e, g, and i are blank. I need to paste the data into those
blank columns.

Ron M.