PC Review


Reply
 
 
LiAD
Guest
Posts: n/a
 
      16th Dec 2009
Hi,

Could some give me a code please to delete the entrie row if any cell in col
C of that row starting from c10 going to the last cell down = ""?

Thanks
LiAD
 
Reply With Quote
 
 
 
 
Ryan H
Guest
Posts: n/a
 
      16th Dec 2009
This should work for you. Just place this code into a standard module and
adjust the name on the worksheet you want to use.

Option Explicit

Sub DeleteRows()

Dim lngLastRow As Long
Dim i As Long

With Sheets("Sheet1")

lngLastRow = .Cells(Rows.Count, "C").End(xlUp).Row

For i = lngLastRow To 10 Step -1
If Cells(i, "C").Value = "" Then
Rows(i).EntireRow.Delete Shift:=xlUp
End If
Next i
End With

End Sub

Hope this helps! If so, click "YES" below.

--
Cheers,
Ryan


"LiAD" wrote:

> Hi,
>
> Could some give me a code please to delete the entrie row if any cell in col
> C of that row starting from c10 going to the last cell down = ""?
>
> Thanks
> LiAD

 
Reply With Quote
 
Ryan H
Guest
Posts: n/a
 
      16th Dec 2009
Correction,

Option Explicit

Sub DeleteRows()

Dim lngLastRow As Long
Dim i As Long

With Sheets("Sheet1")

lngLastRow = .Cells(Rows.Count, "C").End(xlUp).Row

For i = lngLastRow To 10 Step -1
If .Cells(i, "C").Value = "" Then
.Rows(i).EntireRow.Delete Shift:=xlUp
End If
Next i
End With

End Sub
--
Cheers,
Ryan


"Ryan H" wrote:

> This should work for you. Just place this code into a standard module and
> adjust the name on the worksheet you want to use.
>
> Option Explicit
>
> Sub DeleteRows()
>
> Dim lngLastRow As Long
> Dim i As Long
>
> With Sheets("Sheet1")
>
> lngLastRow = .Cells(Rows.Count, "C").End(xlUp).Row
>
> For i = lngLastRow To 10 Step -1
> If Cells(i, "C").Value = "" Then
> Rows(i).EntireRow.Delete Shift:=xlUp
> End If
> Next i
> End With
>
> End Sub
>
> Hope this helps! If so, click "YES" below.
>
> --
> Cheers,
> Ryan
>
>
> "LiAD" wrote:
>
> > Hi,
> >
> > Could some give me a code please to delete the entrie row if any cell in col
> > C of that row starting from c10 going to the last cell down = ""?
> >
> > Thanks
> > LiAD

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      16th Dec 2009

Sub delSome()
Dim lr As Long, rng As Range
lr = ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row
Set rng = ActiveSheet.Range("C10:C" & lr)
For Each c In rng
If c.Value = "" Then
c.EntireRow.Delete
End If
Next
End Sub



"LiAD" <(E-Mail Removed)> wrote in message
news:04515ACA-47D8-448C-B1C2-(E-Mail Removed)...
> Hi,
>
> Could some give me a code please to delete the entrie row if any cell in
> col
> C of that row starting from c10 going to the last cell down = ""?
>
> Thanks
> LiAD



 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      16th Dec 2009
Sorry, delete should go from bottom up.

Sub delSome()
Dim lr As Long
lr = ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row
'Set rng = ActiveSheet.Range("C10:C" & lr)
For i = lr To 10 Step - 1
If Cells(i, 3) = "" Then
Cells(i, 3).EntireRow.Delete
End If
Next
End Sub



"JLGWhiz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Sub delSome()
> Dim lr As Long, rng As Range
> lr = ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row
> Set rng = ActiveSheet.Range("C10:C" & lr)
> For Each c In rng
> If c.Value = "" Then
> c.EntireRow.Delete
> End If
> Next
> End Sub
>
>
>
> "LiAD" <(E-Mail Removed)> wrote in message
> news:04515ACA-47D8-448C-B1C2-(E-Mail Removed)...
>> Hi,
>>
>> Could some give me a code please to delete the entrie row if any cell in
>> col
>> C of that row starting from c10 going to the last cell down = ""?
>>
>> Thanks
>> LiAD

>
>



 
Reply With Quote
 
LiAD
Guest
Posts: n/a
 
      16th Dec 2009
Thanks

"Ryan H" wrote:

> Correction,
>
> Option Explicit
>
> Sub DeleteRows()
>
> Dim lngLastRow As Long
> Dim i As Long
>
> With Sheets("Sheet1")
>
> lngLastRow = .Cells(Rows.Count, "C").End(xlUp).Row
>
> For i = lngLastRow To 10 Step -1
> If .Cells(i, "C").Value = "" Then
> .Rows(i).EntireRow.Delete Shift:=xlUp
> End If
> Next i
> End With
>
> End Sub
> --
> Cheers,
> Ryan
>
>
> "Ryan H" wrote:
>
> > This should work for you. Just place this code into a standard module and
> > adjust the name on the worksheet you want to use.
> >
> > Option Explicit
> >
> > Sub DeleteRows()
> >
> > Dim lngLastRow As Long
> > Dim i As Long
> >
> > With Sheets("Sheet1")
> >
> > lngLastRow = .Cells(Rows.Count, "C").End(xlUp).Row
> >
> > For i = lngLastRow To 10 Step -1
> > If Cells(i, "C").Value = "" Then
> > Rows(i).EntireRow.Delete Shift:=xlUp
> > End If
> > Next i
> > End With
> >
> > End Sub
> >
> > Hope this helps! If so, click "YES" below.
> >
> > --
> > Cheers,
> > Ryan
> >
> >
> > "LiAD" wrote:
> >
> > > Hi,
> > >
> > > Could some give me a code please to delete the entrie row if any cell in col
> > > C of that row starting from c10 going to the last cell down = ""?
> > >
> > > Thanks
> > > LiAD

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      16th Dec 2009
Assuming your cells in Column C have data in them so that your ="" condition
means an empty cell, and not formulas that evaluate to "", then give this
"non looping" macro a try...

Sub DeleteEmptyCellsColumnC()
On Error Resume Next
Range("C10:C" & Cells(Rows.Count, "C").End(xlUp).Row). _
SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub

--
Rick (MVP - Excel)


"LiAD" <(E-Mail Removed)> wrote in message
news:04515ACA-47D8-448C-B1C2-(E-Mail Removed)...
> Hi,
>
> Could some give me a code please to delete the entrie row if any cell in
> col
> C of that row starting from c10 going to the last cell down = ""?
>
> Thanks
> LiAD


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
#delete after code based delete =?Utf-8?B?QnJ1Y2U=?= Microsoft Access Form Coding 2 8th Aug 2007 02:20 AM
Will deleting a Form delete attached code? AND How to see ALL code in dB ? Mel Microsoft Access 2 30th Apr 2007 08:25 PM
Delete data in a linked Excel sheet using Access code or seql delete Rocky Microsoft Access External Data 9 26th Jun 2005 12:42 AM
code to delete a user/ code to move users into and out of groups =?Utf-8?B?dHc=?= Microsoft Access Security 11 30th May 2005 06:59 AM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Microsoft Excel Programming 0 27th Jan 2004 07:07 AM


Features
 

Advertising
 

Newsgroups
 


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