LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Make a macro run on rows/columns only if data is present?

You can build If .... Then....Else....End IF statements that check the cells
Dim cel as range

If len(cel)0 then
' cell is not blank
' do something
End if

If cel = 0 then
' cell has no value except 0
' don't do anything
Else
'do something
End if

And you can put one or more of those statements into a For .. Next loop

For each cel in Range("A1:Z55") ''' change the range to suit your needs
' your code
Next

There are other ways of restricting the ranges that make it even easier.
But we need to know more about what you really have and what you really are
looking at...

--
steveB

Remove "AYN" from email to respond
"bpreas - ExcelForums.com" wrote in
message ...
How can I mave a macro run on fields where there is data present and
ignore empty rows or columns. I have macros that I use regularly, but
the number of rows of data in these spreadsheets varies each time.
Thanks in advance for any help you can provide!



 
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
how to define how may rows or columns are present in excel 03 lostwrite Excel Discussion (Misc queries) 1 February 15th 07 07:59 AM
Make pivot table with multiple "data" fields in columns not rows? cdomby Excel Discussion (Misc queries) 1 January 15th 07 04:54 PM
How do I make sure all empty columns are present in a .csv file? Decision Assist Excel Worksheet Functions 1 September 6th 06 04:40 PM
Continued Conversion of data from rows to columns in a macro. Karaman Excel Programming 5 March 3rd 05 03:29 PM
How do I make a macro present (like an add-in) on opening Excel? pini35[_5_] Excel Programming 2 October 22nd 03 05:33 PM


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