Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving colC to colA
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) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving colC to colA
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) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving colC to colA
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) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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) |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving colC to colA
Ok that works fine.
"Charles Chickering" wrote: 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) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Count # items in ColA if blank in ColB | Excel Worksheet Functions | |||
adding a percentage for COLA to Payroll worksheet | Excel Worksheet Functions | |||
match colC to ColA, put row from ColB for 'answer' | Excel Discussion (Misc queries) | |||
want to count in two columns; countif (colA=x AND colB=y)? | Excel Worksheet Functions | |||
Lookup value in colA whos row matches row of index value in colB | Excel Worksheet Functions |