Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What's wrong with this code? Please help.


Hi All,

I am trying to write a code to delete empty cells far a set of data
range:

Sub mysub()
Dim rRange As Range
Set rRange = Sheet1("E1:E150")
With rRange
If cell.Value = "" Then
ActiveCell.Delete shift:=xlUp
End If
End With

End Sub

Appreciate your help.
Thanks
Syed


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=498504

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default What's wrong with this code? Please help.

Sub DeleteBlanks()
On Error Resume Next
Range("E1:E150").SpecialCells(xlCellTypeBlanks).De lete (xlShiftUp)
End Sub
--
HTH...

Jim Thomlinson


"saziz" wrote:


Hi All,

I am trying to write a code to delete empty cells far a set of data
range:

Sub mysub()
Dim rRange As Range
Set rRange = Sheet1("E1:E150")
With rRange
If cell.Value = "" Then
ActiveCell.Delete shift:=xlUp
End If
End With

End Sub

Appreciate your help.
Thanks
Syed


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=498504


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What's wrong with this code? Please help.


Jim,
It worked prefectly, Thank you
How can I change it to delete rows instead of cells:
Range("f1:f2950")._SpecialCells_(xlCellTypeBlanks) .Delete (xlShiftUp)
^ I want to change this to delete rows


Syed


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=498504

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default What's wrong with this code? Please help.

Sub DeleteBlanks()
On Error Resume Next
Range("E1:E150").SpecialCells(xlCellTypeBlanks).En tireRow.Delete
(xlShiftUp)
End Sub

--
HTH...

Jim Thomlinson


"saziz" wrote:


Jim,
It worked prefectly, Thank you
How can I change it to delete rows instead of cells:
Range("f1:f2950")._SpecialCells_(xlCellTypeBlanks) .Delete (xlShiftUp)
^ I want to change this to delete rows


Syed


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=498504


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
wrong code? minostrada Excel Programming 6 October 26th 05 02:50 PM
What's wrong with this code, please? Jim Berglund Excel Programming 1 August 3rd 04 09:41 PM
What is wrong with this code? Bob Phillips[_6_] Excel Programming 1 January 22nd 04 10:11 PM
What's wrong with this bit of code Mervyn Thomas Excel Programming 7 January 22nd 04 03:56 PM
what's wrong with my code???? cornishbloke[_28_] Excel Programming 5 January 22nd 04 12:10 PM


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