Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default VB Script to remove row

I have a vb script written to just open a workbook and remove the first row.
I need it to remove the row not just delete the cell contents. here is the
script.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\book1.xls")
objExcel.Visible = TRUE
Rows("1:1").Select
Selection.Delete Shift:=xlUp

I keep getting an error on line 5 char 24. Is there a different tag I should
be using?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VB Script to remove row

Try this

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\book1.xls")
objExcel.Visible = TRUE
objWorkbook .ACtivesheet.Rows("1:1").Delete Shift:=xlUp


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Dennis" wrote in message
...
I have a vb script written to just open a workbook and remove the first

row.
I need it to remove the row not just delete the cell contents. here is the
script.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\book1.xls")
objExcel.Visible = TRUE
Rows("1:1").Select
Selection.Delete Shift:=xlUp

I keep getting an error on line 5 char 24. Is there a different tag I

should
be using?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VB Script to remove row

Try this

Change the sheet name

objWorkbook.Sheets("sheet1").Rows("1:1").Delete

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Dennis" wrote in message ...
I have a vb script written to just open a workbook and remove the first row.
I need it to remove the row not just delete the cell contents. here is the
script.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\book1.xls")
objExcel.Visible = TRUE
Rows("1:1").Select
Selection.Delete Shift:=xlUp

I keep getting an error on line 5 char 24. Is there a different tag I should
be using?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default VB Script to remove row

Thanks to both of you. Both ways worked like a charm. I appreciate the
repsonses.

"Dennis" wrote:

I have a vb script written to just open a workbook and remove the first row.
I need it to remove the row not just delete the cell contents. here is the
script.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\book1.xls")
objExcel.Visible = TRUE
Rows("1:1").Select
Selection.Delete Shift:=xlUp

I keep getting an error on line 5 char 24. Is there a different tag I should
be using?

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
remove convert/extract the number from'12345.56; ie remove ' sign WAN Excel Worksheet Functions 2 January 10th 08 12:38 PM
How do I remove hyperlink if 'remove' option is disabled Vipul New Users to Excel 1 January 8th 08 02:34 PM
HOW CAN I REMOVE SCRIPT ERROR FROM MICROSOFT WORD AND EXCEL. HASSAN HAMMOUD Excel Discussion (Misc queries) 2 December 8th 07 04:14 PM
VB Script to remove row Dennis Excel Programming 1 November 11th 04 11:07 PM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM


All times are GMT +1. The time now is 11:03 PM.

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

About Us

"It's about Microsoft Excel"