Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macros in Excel

How can I write a macro that will delte a row in an IF funtion if the logic
is false?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Macros in Excel

Hi Brfiel,

Try something like:

If Not Range("A1").Value Range("A2").Value Then
Range("A1").EntireRow.Delete
End If


---
Regards,
Norman



"l" wrote in message
...
How can I write a macro that will delte a row in an IF funtion if the
logic
is false?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Macros in Excel

Strictly you can't delete a row with a worksheet function such as if, but,
given more detail on what you are actually trying to accomplish, with
examples or scenarios, I am sure we can come up with a solution for your
need

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"brfiel" wrote in message
...
How can I write a macro that will delte a row in an IF funtion if the
logic
is false?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macros in Excel

I want to delete a row if my If function is false and therefore would perform
no calculations. If no calculations then the row is blank and I want to
delete it. What I wondered is if I could put a macro in the third argument
of the If function that would delet the row. Does that make sense?
Thanks for your interest.

"Nick Hodge" wrote:

Strictly you can't delete a row with a worksheet function such as if, but,
given more detail on what you are actually trying to accomplish, with
examples or scenarios, I am sure we can come up with a solution for your
need

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"brfiel" wrote in message
...
How can I write a macro that will delte a row in an IF funtion if the
logic
is false?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Macros in Excel

Sorry it took a while to get back. You cannot fire any kind of macro from a
worksheet function.

From your description it appears you are only trying to delete rows when a
cell in the column is blank.

I may not be understanding you, but you could sort on this column, the
blanks would go to the bottom and you could delete them there.

This too could be automated

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"brfiel" wrote in message
...
I want to delete a row if my If function is false and therefore would
perform
no calculations. If no calculations then the row is blank and I want to
delete it. What I wondered is if I could put a macro in the third
argument
of the If function that would delet the row. Does that make sense?
Thanks for your interest.

"Nick Hodge" wrote:

Strictly you can't delete a row with a worksheet function such as if,
but,
given more detail on what you are actually trying to accomplish, with
examples or scenarios, I am sure we can come up with a solution for your
need

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"brfiel" wrote in message
...
How can I write a macro that will delte a row in an IF funtion if the
logic
is false?








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macros in Excel

Sort would work just fine. Can't believe I didn't think of that.
Thanks a bunch.
Bob

"Nick Hodge" wrote:

Sorry it took a while to get back. You cannot fire any kind of macro from a
worksheet function.

From your description it appears you are only trying to delete rows when a
cell in the column is blank.

I may not be understanding you, but you could sort on this column, the
blanks would go to the bottom and you could delete them there.

This too could be automated

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"brfiel" wrote in message
...
I want to delete a row if my If function is false and therefore would
perform
no calculations. If no calculations then the row is blank and I want to
delete it. What I wondered is if I could put a macro in the third
argument
of the If function that would delet the row. Does that make sense?
Thanks for your interest.

"Nick Hodge" wrote:

Strictly you can't delete a row with a worksheet function such as if,
but,
given more detail on what you are actually trying to accomplish, with
examples or scenarios, I am sure we can come up with a solution for your
need

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"brfiel" wrote in message
...
How can I write a macro that will delte a row in an IF funtion if the
logic
is false?






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
Excel 2007 macros - how to merge 5 macros together into one Sue Excel Discussion (Misc queries) 1 April 16th 08 08:36 PM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM
Making excel macros run Word macros Matthew McManus Excel Programming 1 February 18th 04 02:57 AM
Macro Size Limit / open macros with macros? andycharger[_7_] Excel Programming 6 February 13th 04 02:00 PM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Excel Programming 5 September 24th 03 03:10 AM


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