Open external workbook, select sheet and column to insert

R

Richard

Can anyone help me here. I'm trying to open an external workbook,
select a sheet and select a column in order to insert a new column.

My problem is that instead of selecting column F, it seems to select
some other range "B:M" or something.

From memory (I'm now at home)

Here is what I am using:-

Set wkb = Workbooks..Open(strWorkbook)

wkb.activate

set sht = wkb("MySheet")

With sht

.activate

.columns("F:F").select ' problem seems to be here.
.columns.Insert xlToRight

Set rng = .range("F5:F15").select

For each cell in rng
cell.select
cell.value = 0
Next cell

End With


anyone help me with this one?



Richard





Its a good job Einstein never had to fill out one of these Government Grant applications or we never would have found out what e equalled. The West Wing
 
D

Damian Lee

Try ,columns(6)

Good Luck
-----Original Message-----
Can anyone help me here. I'm trying to open an external workbook,
select a sheet and select a column in order to insert a new column.

My problem is that instead of selecting column F, it seems to select
some other range "B:M" or something.

From memory (I'm now at home)

Here is what I am using:-

Set wkb = Workbooks..Open(strWorkbook)

wkb.activate

set sht = wkb("MySheet")

With sht

.activate

.columns("F:F").select ' problem seems to be here.
.columns.Insert xlToRight

Set rng = .range("F5:F15").select

For each cell in rng
cell.select
cell.value = 0
Next cell

End With


anyone help me with this one?



Richard





Its a good job Einstein never had to fill out one of
these Government Grant applications or we never would have
found out what e equalled. The West Wing
 
R

Richard

Damian Lee said:
Try ,columns(6)

Good Luck
these Government Grant applications or we never would have
found out what e equalled. The West Wing


Nope. This does the same thing. It selects columns B:K instead of
Column F. This is insane. I'm working with a different workbook than
the one I'm in, yet as I step through the code (I don't want to run
the whole code yet, a simple procedure such as selecting one column is
having bizarre results.

HELP!

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top