#1   Report Post  
Posted to microsoft.public.excel.programming
js js is offline
external usenet poster
 
Posts: 6
Default delete rows

Hi,

I have a excel file like this:
id name
1 ll1
2 ll2
abc xxxxxxxxxxxxxx
10 ll3

23 ll4

my job is to remove the empty line or the id column is not numeric, I manual
did it now. I have lot's row. is it possible to do using VBA? just check id
is numeric or empty, then delete? I'm new to excel, please help. Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default delete rows

Hi JS,

just check id is numeric or empty, then delete?


Try:

'=============
Public Sub Tester()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============


---
Regards,
Norman


"js" wrote in message
...
Hi,

I have a excel file like this:
id name
1 ll1
2 ll2
abc xxxxxxxxxxxxxx
10 ll3

23 ll4

my job is to remove the empty line or the id column is not numeric, I
manual did it now. I have lot's row. is it possible to do using VBA? just
check id is numeric or empty, then delete? I'm new to excel, please help.
Thanks.




  #3   Report Post  
Posted to microsoft.public.excel.programming
js js is offline
external usenet poster
 
Posts: 6
Default delete rows

Thanks Norman...

How to run? I'm new to excel.


"Norman Jones" wrote in message
...
Hi JS,

just check id is numeric or empty, then delete?


Try:

'=============
Public Sub Tester()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============


---
Regards,
Norman


"js" wrote in message
...
Hi,

I have a excel file like this:
id name
1 ll1
2 ll2
abc xxxxxxxxxxxxxx
10 ll3

23 ll4

my job is to remove the empty line or the id column is not numeric, I
manual did it now. I have lot's row. is it possible to do using VBA? just
check id is numeric or empty, then delete? I'm new to excel, please help.
Thanks.






  #4   Report Post  
Posted to microsoft.public.excel.programming
js js is offline
external usenet poster
 
Posts: 6
Default delete rows

Hi Norman,

the condition is not numeric,

.SpecialCells(xlCellTypeConstants, xlNumbers).EntireRow.Delete?


How to add it?



"Norman Jones" wrote in message
...
Hi JS,

just check id is numeric or empty, then delete?


Try:

'=============
Public Sub Tester()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============


---
Regards,
Norman


"js" wrote in message
...
Hi,

I have a excel file like this:
id name
1 ll1
2 ll2
abc xxxxxxxxxxxxxx
10 ll3

23 ll4

my job is to remove the empty line or the id column is not numeric, I
manual did it now. I have lot's row. is it possible to do using VBA? just
check id is numeric or empty, then delete? I'm new to excel, please help.
Thanks.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default delete rows

Hi JS,

the condition is not numeric,

.SpecialCells(xlCellTypeConstants, xlNumbers).EntireRow.Delete?


How to add it?


In that case, try this revised version:

'=============
Public Sub TesterA()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlTextValues). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============

As you are new to macros, you may wish to visit David McRitchie's 'Getting
Started With Macros And User Defined Functions' at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

You may also wish to look at David's tutorial page:

http://www.mvps.org/dmcritchie/excel....htm#tutorials

To run the suggested code, try:

Copy the code
Alt-F11 to open the VBA editor
Menus | Insert | Module
Paste the code
Alt-F11 to return to Excel
Select the worksheet of interest
Alt-F8 to open the Macro Dialog
Select the macro in the dropdown window
Run

I suggest that you try the code on a copy of your data to verify that the
code achieves your intended results.


---
Regards,
Norman


"js" wrote in message
...
Hi Norman,

the condition is not numeric,

.SpecialCells(xlCellTypeConstants, xlNumbers).EntireRow.Delete?


How to add it?



"Norman Jones" wrote in message
...
Hi JS,

just check id is numeric or empty, then delete?


Try:

'=============
Public Sub Tester()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============


---
Regards,
Norman


"js" wrote in message
...
Hi,

I have a excel file like this:
id name
1 ll1
2 ll2
abc xxxxxxxxxxxxxx
10 ll3

23 ll4

my job is to remove the empty line or the id column is not numeric, I
manual did it now. I have lot's row. is it possible to do using VBA?
just check id is numeric or empty, then delete? I'm new to excel, please
help. Thanks.










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default delete rows


H Norman,
This code of yours:
'=============
Public Sub TextAndBlanks()
With Columns(1)
..SpecialCells(xlCellTypeConstants, xlTextValues). _
EntireRow.Delete
..SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============
Will delete rows with all combinations of text and spaces IE:
a
1a
1 a
a1
a 1
The other code however for the numbers
'=============
Public Sub NumbersAndBlanks()
With Columns(1)
..SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete
..SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============
Will only delete rows if the entire string is numbers or spaces.
Not when there is a combination IE:
1a
a1
a 1
1 aa

Why wouldn't they both do the same thing, one for numbers, one for
text?
Dave
Norman Jones Wrote:
Hi JS,

the condition is not numeric,

.SpecialCells(xlCellTypeConstants, xlNumbers).EntireRow.Delete?


How to add it?


In that case, try this revised version:

'=============
Public Sub TesterA()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlTextValues). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============

As you are new to macros, you may wish to visit David McRitchie's
'Getting
Started With Macros And User Defined Functions' at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

You may also wish to look at David's tutorial page:

http://www.mvps.org/dmcritchie/excel....htm#tutorials

To run the suggested code, try:

Copy the code
Alt-F11 to open the VBA editor
Menus | Insert | Module
Paste the code
Alt-F11 to return to Excel
Select the worksheet of interest
Alt-F8 to open the Macro Dialog
Select the macro in the dropdown window
Run

I suggest that you try the code on a copy of your data to verify that
the
code achieves your intended results.


---
Regards,
Norman


"js" wrote in message
...
Hi Norman,

the condition is not numeric,

.SpecialCells(xlCellTypeConstants, xlNumbers).EntireRow.Delete?


How to add it?



"Norman Jones" wrote in message
...
Hi JS,

just check id is numeric or empty, then delete?

Try:

'=============
Public Sub Tester()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============


---
Regards,
Norman


"js" wrote in message
...
Hi,

I have a excel file like this:
id name
1 ll1
2 ll2
abc xxxxxxxxxxxxxx
10 ll3

23 ll4

my job is to remove the empty line or the id column is not numeric,

I
manual did it now. I have lot's row. is it possible to do using

VBA?
just check id is numeric or empty, then delete? I'm new to excel,

please
help. Thanks.








--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=493213

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default delete rows

Hi Dave,

The SpecialCells method regards combinations of spaces and alphanumeric
characters as text constants. Therefore, as you observe, the code:

SpecialCells(xlCellTypeConstants, xlTextValues). _
EntireRow.Delete


will delete all alphanumeric strings, including those with embedded spaces.

Number constants cannot include spaces, so the code:

SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete


will ignore any constant containing embedded spaces and only delete numeric
constants.

In both cases, the code:

SpecialCells(xlCellTypeBlanks).EntireRow.Delete


relates only to empty (blank) cells. Empty cells are not recognised as
either text or number constants: hence the use of this latter code line in
both instances.


---
Regards,
Norman



"Desert Piranha"
<Desert.Piranha.200b90_1134524702.0846@excelforu m-nospam.com wrote in
message news:Desert.Piranha.200b90_1134524702.0846@excelfo rum-nospam.com...

H Norman,
This code of yours:
'=============
Public Sub TextAndBlanks()
With Columns(1)
SpecialCells(xlCellTypeConstants, xlTextValues). _
EntireRow.Delete
SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============
Will delete rows with all combinations of text and spaces IE:
a
1a
1 a
a1
a 1
The other code however for the numbers
'=============
Public Sub NumbersAndBlanks()
With Columns(1)
SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete
SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============
Will only delete rows if the entire string is numbers or spaces.
Not when there is a combination IE:
1a
a1
a 1
1 aa

Why wouldn't they both do the same thing, one for numbers, one for
text?
Dave
Norman Jones Wrote:
Hi JS,

the condition is not numeric,

.SpecialCells(xlCellTypeConstants, xlNumbers).EntireRow.Delete?

How to add it?


In that case, try this revised version:

'=============
Public Sub TesterA()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlTextValues). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============

As you are new to macros, you may wish to visit David McRitchie's
'Getting
Started With Macros And User Defined Functions' at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

You may also wish to look at David's tutorial page:

http://www.mvps.org/dmcritchie/excel....htm#tutorials

To run the suggested code, try:

Copy the code
Alt-F11 to open the VBA editor
Menus | Insert | Module
Paste the code
Alt-F11 to return to Excel
Select the worksheet of interest
Alt-F8 to open the Macro Dialog
Select the macro in the dropdown window
Run

I suggest that you try the code on a copy of your data to verify that
the
code achieves your intended results.


---
Regards,
Norman


"js" wrote in message
...
Hi Norman,

the condition is not numeric,

.SpecialCells(xlCellTypeConstants, xlNumbers).EntireRow.Delete?

How to add it?



"Norman Jones" wrote in message
...
Hi JS,

just check id is numeric or empty, then delete?

Try:

'=============
Public Sub Tester()
With Columns(1)
.SpecialCells(xlCellTypeConstants, xlNumbers). _
EntireRow.Delete
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub
'<<=============


---
Regards,
Norman


"js" wrote in message
...
Hi,

I have a excel file like this:
id name
1 ll1
2 ll2
abc xxxxxxxxxxxxxx
10 ll3

23 ll4

my job is to remove the empty line or the id column is not numeric,

I
manual did it now. I have lot's row. is it possible to do using

VBA?
just check id is numeric or empty, then delete? I'm new to excel,

please
help. Thanks.








--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile:
http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=493213



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
Hpw do I delete multiple empty rows found between filled rows? Bill Excel Worksheet Functions 2 November 15th 09 07:12 PM
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows Scott Excel Worksheet Functions 0 December 13th 06 01:25 AM
Delete rows with numeric values, leave rows with text GSpline Excel Programming 5 October 11th 05 12:44 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 01:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"