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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macros



 
 
Thread Tools Display Modes
  #1  
Old December 22nd, 2005, 10:08 AM posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: n/a
Default Macros

Dear Sir

How can I make a macro which will delete all the Blank rows from a data
before pasting it in Excel
  #2  
Old December 22nd, 2005, 11:05 AM posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: n/a
Default Macros

Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim rng As Range

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If Application.CountA(Rows(i)) = 0 Then
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next i

If Not rng Is Nothing Then
rng.Delete

End If

End Sub


--

HTH

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


"Nimesh Shastri" Nimesh wrote in message
...
Dear Sir

How can I make a macro which will delete all the Blank rows from a data
before pasting it in Excel




 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug: Editing digitally signed templates with macros EZStrobe Visio 0 September 17th, 2005 06:19 PM
Macros run inconsistently: run in old records or copies of old rec HBrock New Users 1 February 9th, 2005 11:48 AM
Passing documents with macros and toolbar icons for the macros SteveK Powerpoint 1 February 7th, 2005 07:24 PM
Macros in 2003 multiple but connected problems? V-ger General Discussion 8 January 18th, 2005 09:42 PM
Using macros on custom toolbars in templates. Conan Kelly Worksheet Functions 2 August 2nd, 2004 02:28 PM


All times are GMT +1. The time now is 07:14 PM.


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