Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete a Row
I want to delete a row in a different, open workbook, but can't get the
syntax right. Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete doesn't work. -- Ken Hudson |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete a Row
Hi Ken,
Your syntax works for me. I tested using: '============= Public Sub Tester() Const TestBookName As String = "Book2.xls" Const RowNumber As Long = 2 Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete End Sub '<<============= --- Regards, Norman "Ken Hudson" wrote in message ... I want to delete a row in a different, open workbook, but can't get the syntax right. Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete doesn't work. -- Ken Hudson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete a Row
Hi,
In XL2003 only works if TestBookName="Book2" not "Book2.xls" (or at least on my m/c!) "Norman Jones" wrote: Hi Ken, Your syntax works for me. I tested using: '============= Public Sub Tester() Const TestBookName As String = "Book2.xls" Const RowNumber As Long = 2 Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete End Sub '<<============= --- Regards, Norman "Ken Hudson" wrote in message ... I want to delete a row in a different, open workbook, but can't get the syntax right. Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete doesn't work. -- Ken Hudson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete a Row
It would depend on whether the workbook was named Book2 (an unsaved
workbook) or Book2.xls. I suspect Norman was either using a saved workbook or emphasizing the valuable lesson that if a workbook has been saved, then it should be addressed in the workbooks collection with the extension included. On computers with the Windows setting of Hide Known extensions, then Workbook("Book2") could be used to refer to Book2.xls. -- Regards, Tom Ogilvy "Toppers" wrote in message ... Hi, In XL2003 only works if TestBookName="Book2" not "Book2.xls" (or at least on my m/c!) "Norman Jones" wrote: Hi Ken, Your syntax works for me. I tested using: '============= Public Sub Tester() Const TestBookName As String = "Book2.xls" Const RowNumber As Long = 2 Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete End Sub '<<============= --- Regards, Norman "Ken Hudson" wrote in message ... I want to delete a row in a different, open workbook, but can't get the syntax right. Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete doesn't work. -- Ken Hudson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete a Row
Tom,
Yet another lesson! My workbook had not been saved and hence my result. So much to remember - my age is definitely working against me. Thanks again. "Tom Ogilvy" wrote: It would depend on whether the workbook was named Book2 (an unsaved workbook) or Book2.xls. I suspect Norman was either using a saved workbook or emphasizing the valuable lesson that if a workbook has been saved, then it should be addressed in the workbooks collection with the extension included. On computers with the Windows setting of Hide Known extensions, then Workbook("Book2") could be used to refer to Book2.xls. -- Regards, Tom Ogilvy "Toppers" wrote in message ... Hi, In XL2003 only works if TestBookName="Book2" not "Book2.xls" (or at least on my m/c!) "Norman Jones" wrote: Hi Ken, Your syntax works for me. I tested using: '============= Public Sub Tester() Const TestBookName As String = "Book2.xls" Const RowNumber As Long = 2 Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete End Sub '<<============= --- Regards, Norman "Ken Hudson" wrote in message ... I want to delete a row in a different, open workbook, but can't get the syntax right. Workbooks(TestBookName).Sheets(1).Rows(RowNumber). Delete doesn't work. -- Ken Hudson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below | Excel Programming |