#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Easy Excel Question

Hi All,

I wanted to run a simple script/macro in Excel.

All I wanted is a rule whereby if a cell has a value of 0 (zero) I
would like to delete the row.

Can someone please assist?

TIA
Dolphy

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Easy Excel Question

Consider Cell Z100:

Sub kill_row()
Set r = Range("Z100")
If Not IsEmpty(r) Then
If r.Value = 0 Then
r.EntireRow.Delete
End If
End If
End Sub

Note we check that the cell is not empty and has a real zero in it.
--
Gary''s Student - gsnu200725


"Dolphy" wrote:

Hi All,

I wanted to run a simple script/macro in Excel.

All I wanted is a rule whereby if a cell has a value of 0 (zero) I
would like to delete the row.

Can someone please assist?

TIA
Dolphy


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Easy Excel Question

Hi Gary,

I seem to be unable to use the below script. I'm using Office Xp
(Excel 2002).

I've copy and pasted the script using the below steps:

On the Tools menu in Microsoft Excel, point to Macro, and then click
Visual Basic Editor.
On the Insert menu, click Module.
Type or copy your code into the code window of the module.
If you want to run the macro (macro: An action or a set of actions you
can use to automate tasks. Macros are recorded in the Visual Basic for
Applications programming language.) from the module window, press F5.
When you're finished writing your macro, click Close and Return to
Microsoft Excel on the File menu.

What am I doing wrong?

Rgds,
Dolphy

On May 28, 10:26 am, Gary''s Student
wrote:
Consider Cell Z100:

Sub kill_row()
Set r = Range("Z100")
If Not IsEmpty(r) Then
If r.Value = 0 Then
r.EntireRow.Delete
End If
End If
End Sub

Note we check that the cell is not empty and has a real zero in it.
--
Gary''s Student - gsnu200725



"Dolphy" wrote:
Hi All,


I wanted to run a simple script/macro in Excel.


All I wanted is a rule whereby if a cell has a value of 0 (zero) I
would like to delete the row.


Can someone please assist?


TIA
Dolphy- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Easy Excel Question

You must insure that cell Z100 has a zero in it.
--
Gary''s Student - gsnu200725


"Dolphy" wrote:

Hi Gary,

I seem to be unable to use the below script. I'm using Office Xp
(Excel 2002).

I've copy and pasted the script using the below steps:

On the Tools menu in Microsoft Excel, point to Macro, and then click
Visual Basic Editor.
On the Insert menu, click Module.
Type or copy your code into the code window of the module.
If you want to run the macro (macro: An action or a set of actions you
can use to automate tasks. Macros are recorded in the Visual Basic for
Applications programming language.) from the module window, press F5.
When you're finished writing your macro, click Close and Return to
Microsoft Excel on the File menu.

What am I doing wrong?

Rgds,
Dolphy

On May 28, 10:26 am, Gary''s Student
wrote:
Consider Cell Z100:

Sub kill_row()
Set r = Range("Z100")
If Not IsEmpty(r) Then
If r.Value = 0 Then
r.EntireRow.Delete
End If
End If
End Sub

Note we check that the cell is not empty and has a real zero in it.
--
Gary''s Student - gsnu200725



"Dolphy" wrote:
Hi All,


I wanted to run a simple script/macro in Excel.


All I wanted is a rule whereby if a cell has a value of 0 (zero) I
would like to delete the row.


Can someone please assist?


TIA
Dolphy- Hide quoted text -


- Show quoted text -




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Easy Excel Question


Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from the Excel worksheet:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

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




--
Gary''s Student - gsnu200725


"Dolphy" wrote:

Hi Gary,

I seem to be unable to use the below script. I'm using Office Xp
(Excel 2002).

I've copy and pasted the script using the below steps:

On the Tools menu in Microsoft Excel, point to Macro, and then click
Visual Basic Editor.
On the Insert menu, click Module.
Type or copy your code into the code window of the module.
If you want to run the macro (macro: An action or a set of actions you
can use to automate tasks. Macros are recorded in the Visual Basic for
Applications programming language.) from the module window, press F5.
When you're finished writing your macro, click Close and Return to
Microsoft Excel on the File menu.

What am I doing wrong?

Rgds,
Dolphy

On May 28, 10:26 am, Gary''s Student
wrote:
Consider Cell Z100:

Sub kill_row()
Set r = Range("Z100")
If Not IsEmpty(r) Then
If r.Value = 0 Then
r.EntireRow.Delete
End If
End If
End Sub

Note we check that the cell is not empty and has a real zero in it.
--
Gary''s Student - gsnu200725



"Dolphy" wrote:
Hi All,


I wanted to run a simple script/macro in Excel.


All I wanted is a rule whereby if a cell has a value of 0 (zero) I
would like to delete the row.


Can someone please assist?


TIA
Dolphy- Hide quoted text -


- Show quoted text -






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Easy Excel Question

Hi Gary,

I've tried running the macro, this time I've ensured that cell Z100
has a zero (0) in it and I'm getting the following error when I try to
run the macro:

Compile error:
Expected: end of statement

Rgds,
Dolphy


On May 28, 10:51 pm, Gary''s Student
wrote:
Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from the Excel worksheet:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

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

--
Gary''s Student - gsnu200725



"Dolphy" wrote:
Hi Gary,


I seem to be unable to use the below script. I'm using Office Xp
(Excel 2002).


I've copy and pasted the script using the below steps:


On the Tools menu in Microsoft Excel, point to Macro, and then click
Visual Basic Editor.
On the Insert menu, click Module.
Type or copy your code into the code window of the module.
If you want to run the macro (macro: An action or a set of actions you
can use to automate tasks. Macros are recorded in the Visual Basic for
Applications programming language.) from the module window, press F5.
When you're finished writing your macro, click Close and Return to
Microsoft Excel on the File menu.


What am I doing wrong?


Rgds,
Dolphy


On May 28, 10:26 am, Gary''s Student
wrote:
Consider Cell Z100:


Sub kill_row()
Set r = Range("Z100")
If Not IsEmpty(r) Then
If r.Value = 0 Then
r.EntireRow.Delete
End If
End If
End Sub


Note we check that the cell is not empty and has a real zero in it.
--
Gary''s Student - gsnu200725


"Dolphy" wrote:
Hi All,


I wanted to run a simple script/macro in Excel.


All I wanted is a rule whereby if a cell has a value of 0 (zero) I
would like to delete the row.


Can someone please assist?


TIA
Dolphy- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Easy Excel Question

You've changed Gary's Student's code.

Either recopy and paste it again or share the code you're using.

Dolphy wrote:

Hi Gary,

I've tried running the macro, this time I've ensured that cell Z100
has a zero (0) in it and I'm getting the following error when I try to
run the macro:

Compile error:
Expected: end of statement

Rgds,
Dolphy

On May 28, 10:51 pm, Gary''s Student
wrote:
Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from the Excel worksheet:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

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

--
Gary''s Student - gsnu200725



"Dolphy" wrote:
Hi Gary,


I seem to be unable to use the below script. I'm using Office Xp
(Excel 2002).


I've copy and pasted the script using the below steps:


On the Tools menu in Microsoft Excel, point to Macro, and then click
Visual Basic Editor.
On the Insert menu, click Module.
Type or copy your code into the code window of the module.
If you want to run the macro (macro: An action or a set of actions you
can use to automate tasks. Macros are recorded in the Visual Basic for
Applications programming language.) from the module window, press F5.
When you're finished writing your macro, click Close and Return to
Microsoft Excel on the File menu.


What am I doing wrong?


Rgds,
Dolphy


On May 28, 10:26 am, Gary''s Student
wrote:
Consider Cell Z100:


Sub kill_row()
Set r = Range("Z100")
If Not IsEmpty(r) Then
If r.Value = 0 Then
r.EntireRow.Delete
End If
End If
End Sub


Note we check that the cell is not empty and has a real zero in it.
--
Gary''s Student - gsnu200725


"Dolphy" wrote:
Hi All,


I wanted to run a simple script/macro in Excel.


All I wanted is a rule whereby if a cell has a value of 0 (zero) I
would like to delete the row.


Can someone please assist?


TIA
Dolphy- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Easy Excel Question

something like

for i=cells(rows.count,"a").end(xlup).row to 2 step -1
if cells(i,"a")=0 then rows(i).delete
next i

--
Don Guillett
SalesAid Software

"Dolphy" wrote in message
ups.com...
Hi All,

I wanted to run a simple script/macro in Excel.

All I wanted is a rule whereby if a cell has a value of 0 (zero) I
would like to delete the row.

Can someone please assist?

TIA
Dolphy


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
Easy Excel formula question bearsfan Excel Discussion (Misc queries) 6 December 24th 06 04:50 PM
*EASY* question! Laura \( '_' \) New Users to Excel 3 November 25th 05 12:02 PM
excel easy question !!!! Marcello_Geo Setting up and Configuration of Excel 1 August 23rd 05 11:48 AM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM
easy question .... i think Dean Excel Discussion (Misc queries) 1 January 6th 05 06:31 PM


All times are GMT +1. The time now is 01:21 AM.

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"