Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Neda
 
Posts: n/a
Default Conditional Number Formatting

Hi,
I need to number format a group of cells based on the number contained in
another cell. In other words, if the value in A1 is 1 I need to format A2 to
D2 as percent, if the value in A1 is 0 I need to format A2 to D2 as a number.

From, trying to figure out how t odo it I gathered that conditional
formatting will not be able to do it, and I don't know how to write a macro
to do it so any help will be appreciate it.
Thanks in advance.
Neda
  #2   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey
 
Posts: n/a
Default Conditional Number Formatting

one way:

Put this in your worksheet code module (right-click the worksheet tab an
choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then _
Range("A2:D2").NumberFormat = _
IIf(Range("A1").Value = 1, "0%", "0.00")
End Sub


Adjust the formats as desired.

In article ,
"Neda" wrote:

Hi,
I need to number format a group of cells based on the number contained in
another cell. In other words, if the value in A1 is 1 I need to format A2 to
D2 as percent, if the value in A1 is 0 I need to format A2 to D2 as a number.

From, trying to figure out how t odo it I gathered that conditional
formatting will not be able to do it, and I don't know how to write a macro
to do it so any help will be appreciate it.
Thanks in advance.
Neda

  #3   Report Post  
Posted to microsoft.public.excel.misc
neda5
 
Posts: n/a
Default Conditional Number Formatting

Works greatly.
Thanks.

"JE McGimpsey" wrote:

one way:

Put this in your worksheet code module (right-click the worksheet tab an
choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then _
Range("A2:D2").NumberFormat = _
IIf(Range("A1").Value = 1, "0%", "0.00")
End Sub


Adjust the formats as desired.

In article ,
"Neda" wrote:

Hi,
I need to number format a group of cells based on the number contained in
another cell. In other words, if the value in A1 is 1 I need to format A2 to
D2 as percent, if the value in A1 is 0 I need to format A2 to D2 as a number.

From, trying to figure out how t odo it I gathered that conditional
formatting will not be able to do it, and I don't know how to write a macro
to do it so any help will be appreciate it.
Thanks in advance.
Neda


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
Conditional Formatting John O. Knoke Excel Worksheet Functions 5 May 22nd 05 05:59 PM
Conditional Formatting Error ddate Excel Worksheet Functions 0 May 5th 05 09:00 PM
Conditional Formatting (Date vs Number) [email protected] Excel Discussion (Misc queries) 7 December 20th 04 10:23 PM
Formatting a cell as "text" in the number catagory. Ed Excel Worksheet Functions 3 December 7th 04 07:12 PM
Conditional Formatting Graham Warren Excel Worksheet Functions 0 November 7th 04 04:58 PM


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"