Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting column in a worksheet that is not active worksheet
Could anyone please tell me (a) Why the following line of code will work only if "Test" is the active worksheet. Sheets("Test").Cells(1, 1).EntireColumn.Delete (b) How can I delete a column in a particular worksheet without selecting that worksheet. Thank you very much. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting column in a worksheet that is not active worksheet
That exact code works on my machine to delete column 1. A little shorter
would be Sheets("Test").Columns(1).Delete but that is just a matter of preference... -- HTH... Jim Thomlinson " wrote: Could anyone please tell me (a) Why the following line of code will work only if "Test" is the active worksheet. Sheets("Test").Cells(1, 1).EntireColumn.Delete (b) How can I delete a column in a particular worksheet without selecting that worksheet. Thank you very much. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting column in a worksheet that is not active worksheet
I'm using excel 2000 on xp pro.
I used: Sub test() Sheets("Test").Cells(1, 1).EntireColumn.Delete End Sub It seemed to work if I put the the sub in the Sheet1 module or in ThisWorkbook module. I couldn't get it to fail. Dan On Oct 3, 4:58 pm, wrote: Could anyone please tell me (a) Why the following line of code will work only if "Test" is the active worksheet. Sheets("Test").Cells(1, 1).EntireColumn.Delete (b) How can I delete a column in a particular worksheet without selecting that worksheet. Thank you very much. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting column in a worksheet that is not active worksheet
Jim Thomlinson, Dan Dungan:
Thanks for the courtesy of your response. I have been repeating that code, and it works, as both of you indicated. Despite several attempts, I have not been able to reproduce the error from my earlier workbook that was making me more than a little frustrated. I hope I did not waste too much of your time. Jim Thomlinson, Thanks for suggesting the shorter version for deleting columns. --------------------------------------------------------------------------- That exact code works on my machine to delete column 1. A little shorter would be Sheets("Test").Columns(1).Delete but that is just a matter of preference... -- HTH... Jim Thomlinson --------------------------------------------------------------------------- I'm using excel 2000 on xp pro I'm using excel 2000 on xp pro. I used: Sub test() Sheets("Test").Cells(1, 1).EntireColumn.Delete End Sub It seemed to work if I put the the sub in the Sheet1 module or in ThisWorkbook module. I couldn't get it to fail. Dan Dungan On Oct 3, 7:58 pm, wrote: Could anyone please tell me (a) Why the following line of code will work only if "Test" is the active worksheet. Sheets("Test").Cells(1, 1).EntireColumn.Delete (b) How can I delete a column in a particular worksheet without selecting that worksheet. Thank you very much. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Basic Question - How do I return the worksheet number of the active worksheet? | Excel Programming | |||
Active cell, row, column, worksheet, etc | Excel Programming | |||
Report All Column Widths In Active Worksheet - Corrected | Excel Programming | |||
Report All Column Widths In Active Worksheet - an example | Excel Programming | |||
macro to apply worksheet event to active worksheet | Excel Programming |