Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sal Sal is offline
external usenet poster
 
Posts: 84
Default Delete Rows and Sheets

Is there a better way to delete row 1 in Sheet1 than this

Sheets("Sheet1").Select
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Range("A1").Select

Is there a better way to delete Column B in Sheet1 than this?

Sheets("Sheet1").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft

Is there a better way using Sheet1, to Cut Column D and paste the cut cells
in front of Column A than this?
Sheets("Sheet1").Select
Columns("D:D").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Delete Rows and Sheets

When you record a macro ;each single action is recorded....the below code
does the same 3 actions///

Sheets("Sheet1").Rows(1).Delete
Sheets("Sheet1").Columns(1).Delete
Columns("A:A").Insert Shift:=xlToRight



If this post helps click Yes
---------------
Jacob Skaria


"Sal" wrote:

Is there a better way to delete row 1 in Sheet1 than this

Sheets("Sheet1").Select
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Range("A1").Select

Is there a better way to delete Column B in Sheet1 than this?

Sheets("Sheet1").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft

Is there a better way using Sheet1, to Cut Column D and paste the cut cells
in front of Column A than this?
Sheets("Sheet1").Select
Columns("D:D").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Delete Rows and Sheets

You can avoid the Workbook and sheetname..

With ActiveWorkbook.Sheets("Sheet1")
..Rows(1).Delete
..Columns(1).Delete
..Columns("D:D").Cut
..Columns("A:A").Insert Shift:=xlToRight
End With

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

When you record a macro ;each single action is recorded....the below code
does the same 3 actions///

Sheets("Sheet1").Rows(1).Delete
Sheets("Sheet1").Columns(1).Delete
Columns("A:A").Insert Shift:=xlToRight



If this post helps click Yes
---------------
Jacob Skaria


"Sal" wrote:

Is there a better way to delete row 1 in Sheet1 than this

Sheets("Sheet1").Select
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Range("A1").Select

Is there a better way to delete Column B in Sheet1 than this?

Sheets("Sheet1").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft

Is there a better way using Sheet1, to Cut Column D and paste the cut cells
in front of Column A than this?
Sheets("Sheet1").Select
Columns("D:D").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight

  #4   Report Post  
Posted to microsoft.public.excel.programming
Sal Sal is offline
external usenet poster
 
Posts: 84
Default Delete Rows and Sheets

Perfect! Thank you

"Jacob Skaria" wrote:

When you record a macro ;each single action is recorded....the below code
does the same 3 actions///

Sheets("Sheet1").Rows(1).Delete
Sheets("Sheet1").Columns(1).Delete
Columns("A:A").Insert Shift:=xlToRight



If this post helps click Yes
---------------
Jacob Skaria


"Sal" wrote:

Is there a better way to delete row 1 in Sheet1 than this

Sheets("Sheet1").Select
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Range("A1").Select

Is there a better way to delete Column B in Sheet1 than this?

Sheets("Sheet1").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft

Is there a better way using Sheet1, to Cut Column D and paste the cut cells
in front of Column A than this?
Sheets("Sheet1").Select
Columns("D:D").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight

  #5   Report Post  
Posted to microsoft.public.excel.programming
Sal Sal is offline
external usenet poster
 
Posts: 84
Default Delete Rows and Sheets

Excellent. Thank you for the help.

"Jacob Skaria" wrote:

You can avoid the Workbook and sheetname..

With ActiveWorkbook.Sheets("Sheet1")
.Rows(1).Delete
.Columns(1).Delete
.Columns("D:D").Cut
.Columns("A:A").Insert Shift:=xlToRight
End With

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

When you record a macro ;each single action is recorded....the below code
does the same 3 actions///

Sheets("Sheet1").Rows(1).Delete
Sheets("Sheet1").Columns(1).Delete
Columns("A:A").Insert Shift:=xlToRight



If this post helps click Yes
---------------
Jacob Skaria


"Sal" wrote:

Is there a better way to delete row 1 in Sheet1 than this

Sheets("Sheet1").Select
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Range("A1").Select

Is there a better way to delete Column B in Sheet1 than this?

Sheets("Sheet1").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft

Is there a better way using Sheet1, to Cut Column D and paste the cut cells
in front of Column A than this?
Sheets("Sheet1").Select
Columns("D:D").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete rows of data in multiple sheets Yossy Excel Programming 14 October 26th 08 02:46 PM
Complex sheets - how can I delete rows without destroying formulas? Sybille Lausitz Links and Linking in Excel 1 June 6th 08 08:47 AM
Delete rows in multiple sheets without loop? MTT727 Excel Programming 2 July 26th 05 03:07 PM
How can I delete similar rows in excel workbook with many sheets? JSchrader Excel Worksheet Functions 1 April 26th 05 06:40 PM
Delete Rows from multiple Sheets. drbobsled Excel Programming 3 April 7th 05 01:23 AM


All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"