View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Charles Chickering Charles Chickering is offline
external usenet poster
 
Posts: 272
Default Moving colC to colA

Sub MoveC()
Dim eApp As Object
Dim WB As Object
Dim r As Object
Set eApp = CreateObject(Excel.Application)
Set WB = eApp.Workbooks.Add
WB.Worksheets(1).Columns("C:C").Cut
WB.Worksheets(1).Columns("A:A").Insert Shift:=xlToRight
End Sub

Something along those lines should get a scripting file to work. I'm not
sure exactly what the rest of your code looks like though.
--
Charles Chickering

"A good example is twice the value of good advice."


"Mike" wrote:

How would you wirte that in VBScript?

"Charles Chickering" wrote:

Mike, this is straight from the macro recorder:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 2/13/2007 by cchickering
'

'
Columns("C:C").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
End Sub

And this is the same code cleaned up:
Sub Macro1()
Columns("C:C").Cut
Columns("A:A").Insert Shift:=xlToRight
End Sub
--
Charles Chickering

"A good example is twice the value of good advice."


"Mike" wrote:

I want to move colC to ColA. I also want colA to not be destroyed. This is
what I'm doing so far. Thanks in advance.


Set objRange = objWorksheet.Range("C1").EntireColumn
objRange.Copy

Set objWorksheet = objWorkbook.Worksheets(1)
objWorksheet.Activate

Set objRange = objWorksheet.Range("A1")
objWorksheet.Paste (objRange)