View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Getting a Select Range class field during a macro setup

Avoid selecting the range and all will be well. In order to select a range on
a specific sheet you first have to select the sheet (which you probably have
not done). Try this

Sheet2.Columns("T:T").Delete Shift:=xlToLeft

Since there is no selecting there should be no problem.
--
HTH...

Jim Thomlinson


"ssciarrino" wrote:

I am a very newbie to Visual Basic. What I am trying to do is automate a
journal file conversion process via Excel worksheets.

I want on Sheet2 to remove column T when column T equals 01/01/1900, but
before we add the if statement I simply want to just delete the column. The
macro works well if I am on sheet2

Columns("T:T").Select
Selection.Delete Shift:=xlToLeft

But if I do this

Sheet2.Columns("T:T").Select
Selection.Delete Shift:=xlToLeft

Then I get this error

Run-time error 1004
Select method of Range class failed

This is so stupid simple I am missing something...now I realize I do not
have the 'If column T = 1/1/1900. I am just trying to delete the column
regardless of the condition from another sheet in the workbook.

thanks