LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 407
Default How to zero out non-contiguous ranges

Yes, I took Tom's out of context. The point of the subroutine is to hide
some rows but, first, to make sure all their inputs are zero. That's why I
have them together. I would never do the 2nd without the first. I know
you experts think this is bad technique! Sorry.

One other thing, while I'm here. This is a question about EXCEL, not
macros. Seemingly all of a sudden (though probably not), I am noticing that
most of my inputs that are zero are showing as blank which, often, I'd
rather not be the case - I'd like to see the zero, or 0%. I checked the
usual suspects, such as conditional formatting, white fonts,
protection-hidden but none were the cause. It seems that this is simply the
default of some of EXCEL's common formats, such as integer and percent.
Somehow, I don't remember such being the case, but I am probably just losing
it! Though I know I can use custom formats, I don't like to deal with them
any more than necessary and so I ask: If what I suggested above is true, is
there a way to change EXCEL's simple formats, the kind that have those
clickable buttons?

Macro works nice now.

Thanks!
Dean

"Bill Renaud" wrote in message
. ..
Hi Dean,

Yes, the problems with mixing code from 2 different authors! Tom did not
declare his variables, and I always use "Option Explicit" at the top of my
code modules, so that is what is producing the "variable not defined
error". The variable "cell" was from his code, which was not defined in my
routine.

Try this version for the Clear routine. It sets the value of the unlocked
cells to zero, rather than clearing each cell. Using ClearContents clears
the cell of all formulas and values, so it will be blank just like a new
worksheet.

Public Sub ClearAandDLoanDrawPercents()
Dim rngCellsToClear As Range
Dim rngCell As Range

Set rngCellsToClear = ThisWorkbook _
.Names("AandDLoanDrawPercents") _
.RefersToRange

For Each rngCell In rngCellsToClear
With rngCell
If Not .Locked Then .Value = 0
End With
Next rngCell
End Sub

I think "Hide_AandD_Rows" should be a separate routine. I don't quite
understand that part yet.
--
Regards,
Bill Renaud





 
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 zero out non-contiguous ranges Tom Ogilvy Excel Programming 0 September 26th 07 01:46 PM
Non contiguous ranges AD108 Excel Programming 4 November 23rd 06 03:59 PM
vlookup on non-contiguous ranges BorisS Excel Worksheet Functions 2 June 15th 06 10:28 AM
Adding Non-Contiguous Ranges COE Excel Discussion (Misc queries) 11 January 24th 06 11:43 PM
sorting non contiguous ranges gsh20 Excel Discussion (Misc queries) 1 September 8th 05 04:50 PM


All times are GMT +1. The time now is 07:15 AM.

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"