Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i'm using the following code to clear/delete anything and everything in already existing sheets:
Sub wbclear() Dim N As Long Dim ttl As Long ttl = ThisWorkbook.Worksheets.Count For N = 1 To ttl Worksheets(N).Cells.Delete Next N End Sub what i'd also want is to have cell a1 selected but adding range("a1").select does not work, and i think it's simply because i'm never activating the sheets via code, just deleting the data held in the sheets. is there a bit of code i could use to select cells without activating the sheet? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi Matthew Dyer,
Sub test() For Each sh In Worksheets With sh .Cells.Delete End With Next End Sub isabelle Le 2014-11-12 22:56, Matthew Dyer a écrit : i'm using the following code to clear/delete anything and everything in already existing sheets: Sub wbclear() Dim N As Long Dim ttl As Long ttl = ThisWorkbook.Worksheets.Count For N = 1 To ttl Worksheets(N).Cells.Delete Next N End Sub what i'd also want is to have cell a1 selected but adding range("a1").select does not work, and i think it's simply because i'm never activating the sheets via code, just deleting the data held in the sheets. is there a bit of code i could use to select cells without activating the sheet? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry, i forgot to select cell A1
Sub test() For Each sh In Worksheets With sh .Cells.Delete Application.Goto .Cells(1, 1) End With Next End Sub isabelle Le 2014-11-12 23:20, isabelle a écrit : hi Matthew Dyer, Sub test() For Each sh In Worksheets With sh .Cells.Delete End With Next End Sub isabelle Le 2014-11-12 22:56, Matthew Dyer a écrit : i'm using the following code to clear/delete anything and everything in already existing sheets: Sub wbclear() Dim N As Long Dim ttl As Long ttl = ThisWorkbook.Worksheets.Count For N = 1 To ttl Worksheets(N).Cells.Delete Next N End Sub what i'd also want is to have cell a1 selected but adding range("a1").select does not work, and i think it's simply because i'm never activating the sheets via code, just deleting the data held in the sheets. is there a bit of code i could use to select cells without activating the sheet? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Wednesday, November 12, 2014 9:57:01 PM UTC-6, Matthew Dyer wrote:
i'm using the following code to clear/delete anything and everything in already existing sheets: Sub wbclear() Dim N As Long Dim ttl As Long ttl = ThisWorkbook.Worksheets.Count For N = 1 To ttl Worksheets(N).Cells.Delete Next N End Sub what i'd also want is to have cell a1 selected but adding range("a1").select does not work, and i think it's simply because i'm never activating the sheets via code, just deleting the data held in the sheets. is there a bit of code i could use to select cells without activating the sheet? changing cells.delete to .usedrange.rows.delete may be faster |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I see the Horns got the job done yesterday.
Maybe see Aggies in an all Texas bowl? Gord On Fri, 14 Nov 2014 08:06:59 -0800 (PST), wrote: On Wednesday, November 12, 2014 9:57:01 PM UTC-6, Matthew Dyer wrote: i'm using the following code to clear/delete anything and everything in already existing sheets: Sub wbclear() Dim N As Long Dim ttl As Long ttl = ThisWorkbook.Worksheets.Count For N = 1 To ttl Worksheets(N).Cells.Delete Next N End Sub what i'd also want is to have cell a1 selected but adding range("a1").select does not work, and i think it's simply because i'm never activating the sheets via code, just deleting the data held in the sheets. is there a bit of code i could use to select cells without activating the sheet? changing cells.delete to .usedrange.rows.delete may be faster |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clear all including objects without deleting sheets | Excel Programming | |||
Clear all including objects without deleting sheets | Excel Programming | |||
Clear Contents of all Sheets | Excel Programming | |||
Clear entire rows below last row of data in col A except in 1st 3 sheets | Excel Programming | |||
Clear Sheets in Excel | Excel Programming |