Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 186
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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
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
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 05:11 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:54 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:20 PM
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 Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 07:51 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"