A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Trying to delete blank rows after file save



 
 
Thread Tools Display Modes
  #1  
Old April 15th, 2010, 09:31 PM posted to microsoft.public.excel.misc
PM
external usenet poster
 
Posts: 158
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  
Old April 15th, 2010, 11:48 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:04 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.