Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to move cells with VBA?
After exporting a table from Access into Excel, I need to move the data down
45 rows via automation. This is working, but seems inefficient: Do While fr < 45 xlapp.Workbooks(strXlsFile).Worksheets(sn).Cells(f r + 1, "A"). _ EntireRow.Insert shift:=xlDown fr = fr + 1 Loop Is there a better way to move this contiguous block of cells? There is no other data in the worksheet, and the cells always begin at A1. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to move cells with VBA?
To cut and move:
ActiveSheet.UsedRange.Cut _ Destination:=Range("A45") To move and clear: Dim x As Integer x = ActiveSheet.UsedRange.Rows.Count ActiveSheet.UsedRange.Copy _ Destination:=Range("A45") Range(Rows(1), Rows(x)).ClearContents To move values and clear: Dim x As Integer x = ActiveSheet.UsedRange.Rows.Count ActiveSheet.UsedRange.Offset(45, 0).Value = ActiveSheet.UsedRange.Value Range(Rows(1), Rows(x)).ClearContents -- steveB Remove "AYN" from email to respond "deko" wrote in message . com... After exporting a table from Access into Excel, I need to move the data down 45 rows via automation. This is working, but seems inefficient: Do While fr < 45 xlapp.Workbooks(strXlsFile).Worksheets(sn).Cells(f r + 1, "A"). _ EntireRow.Insert shift:=xlDown fr = fr + 1 Loop Is there a better way to move this contiguous block of cells? There is no other data in the worksheet, and the cells always begin at A1. Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to move cells with VBA?
have you tried?
Sub InsertRows() Rows("1:44").Insert End Sub -- Don Guillett SalesAid Software "deko" wrote in message . com... After exporting a table from Access into Excel, I need to move the data down 45 rows via automation. This is working, but seems inefficient: Do While fr < 45 xlapp.Workbooks(strXlsFile).Worksheets(sn).Cells(f r + 1, "A"). _ EntireRow.Insert shift:=xlDown fr = fr + 1 Loop Is there a better way to move this contiguous block of cells? There is no other data in the worksheet, and the cells always begin at A1. Thanks in advance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to move cells with VBA?
Sub InsertRows()
Rows("1:44").Insert End Sub That was easy.... xlapp.Workbooks(strXlsFile).Worksheets(sn).Rows("1 :44").Insert Thanks! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to move cells with VBA?
glad to help
-- Don Guillett SalesAid Software "deko" wrote in message om... Sub InsertRows() Rows("1:44").Insert End Sub That was easy.... xlapp.Workbooks(strXlsFile).Worksheets(sn).Rows("1 :44").Insert Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can references (to cells being sorted) move with the cells? | Setting up and Configuration of Excel | |||
Move cells according to value | Excel Discussion (Misc queries) | |||
Sorting cells: a list behind the cells do not move with the cell | Excel Discussion (Misc queries) | |||
Move 2 cells to right | Excel Discussion (Misc queries) | |||
Move cells | Excel Programming |