Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
pm pm is offline
external usenet poster
 
Posts: 122
Default Trying to delete blank rows after file save


In a spreadsheet I pull specific data out and copy into another spreadsheet.
Then, if there are any blank rows I would like to delete them and save the
file again. Here's my example:

Selection.Copy
Workbooks.Open Filename:= _
"X:\Legal to Accounting Check Requests\slsTax dbapcvi.csv"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

ActiveWorkbook.SaveAs Filename:= _
"X:\Legal to Accounting Check Requests\slsTax dbapcviTEST.csv",
FileFormat _
:=xlCSV, CreateBackup:=False

Set r = Range("A2:A200")
Set rr = r.SpecialCells(xlCellTypeBlanks)
rr.EntireRow.Delete


1 6258 40283-6258 0 0 ALD IMMCK
6259 40283-6259 0 0 ALD IMMCK
1 6260 40283-6260 0 0 ALD IMMCK
1 6261 40283-6261 0 0 ALD IMMCK

In this example above i'd like to delete the second row. Once I save the
active workbook I am want to delete the rows using the above Set r......
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Trying to delete blank rows after file save

So why not add another line like this one -- just change the filename to what
you want.

ActiveWorkbook.SaveAs Filename:= _
"X:\Legal to Accounting Check Requests\slsTax dbapcviTEST.csv",
FileFormat _
:=xlCSV, CreateBackup:=False


pm wrote:

In a spreadsheet I pull specific data out and copy into another spreadsheet.
Then, if there are any blank rows I would like to delete them and save the
file again. Here's my example:

Selection.Copy
Workbooks.Open Filename:= _
"X:\Legal to Accounting Check Requests\slsTax dbapcvi.csv"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

ActiveWorkbook.SaveAs Filename:= _
"X:\Legal to Accounting Check Requests\slsTax dbapcviTEST.csv",
FileFormat _
:=xlCSV, CreateBackup:=False

Set r = Range("A2:A200")
Set rr = r.SpecialCells(xlCellTypeBlanks)
rr.EntireRow.Delete


1 6258 40283-6258 0 0 ALD IMMCK
6259 40283-6259 0 0 ALD IMMCK
1 6260 40283-6260 0 0 ALD IMMCK
1 6261 40283-6261 0 0 ALD IMMCK

In this example above i'd like to delete the second row. Once I save the
active workbook I am want to delete the rows using the above Set r......


--

Dave Peterson
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
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
How to delete alternating BLANK rows in .xls file all @ once? Desperate Excel Discussion (Misc queries) 3 October 27th 09 08:34 PM
Delete blank rows Marie Bayes Excel Discussion (Misc queries) 5 April 29th 09 01:59 PM
Delete Blank Rows Heather Excel Discussion (Misc queries) 9 July 15th 08 09:32 PM
delete blank rows Pam C Excel Discussion (Misc queries) 1 January 17th 06 07:13 PM


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