Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default cell formatting based on combobox

I think you will need to cycle through each cell

If ComboBox10.Value = "% of Revenue" Then
For Each cell In Sheets("IncStmtAssump").Range("C11:H11")
.Value = format(.Value, "0.00%")
Next cell
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"bruce forster" wrote in message
...
I have written the following code and the worksheet cell formatting does

not work.
THIS IS THE CODE THAT DOES NOT WORK
If ComboBox10.Value = "% of Revenue" Then

Sheets("IncStmtAssump").Range("C11:H11").Text =
format(Sheets("IncStmtAssump").Range("C11:H11").Te xt, "0.00%")
If ComboBox10.Value = "Input" Then

Sheets("IncStmtAssump").Range("C11:H11").Text =
format(Sheets("IncStmtAssump").Range("C11:H11").Te xt, "$#,##0")
If ComboBox10.Value = "% Change from Previous Year" Then

Sheets("IncStmtAssump").Range("C11:H11").Text =
format(Sheets("IncStmtAssump").Range("C11:H11").Te xt, "0.00%")
If ComboBox10.Value = "$ Change from Previous Year" Then

Sheets("IncStmtAssump").Range("C11:H11").Text =
format(Sheets("IncStmtAssump").Range("C11:H11").Te xt, "$#,##0")


Any suggestions??

THIS IS ALL THE CODE
Private Sub ComboBox10_AfterUpdate()
TextBox66.Value = Sheets("IncStmtAssump").Range("c11")
If ComboBox10.Value = "% of Revenue" Then TextBox66.Text =

format(TextBox66.Text, "0.00%")
If ComboBox10.Value = "Input" Then TextBox66.Text =

format(TextBox66.Text, "$#,##0")
If ComboBox10.Value = "% Change from Previous Year" Then

TextBox66.Text = format(TextBox66.Text, "0.00%")
If ComboBox10.Value = "$ Change from Previous Year" Then

TextBox66.Text = format(TextBox66.Text, "$#,##0")

TextBox67.Value = Sheets("IncStmtAssump").Range("D11")
If ComboBox10.Value = "% of Revenue" Then TextBox67.Text =

format(TextBox67.Text, "0.00%")
If ComboBox10.Value = "Input" Then TextBox67.Text =

format(TextBox67.Text, "$#,##0")
If ComboBox10.Value = "% Change from Previous Year" Then

TextBox67.Text = format(TextBox67.Text, "0.00%")
If ComboBox10.Value = "$ Change from Previous Year" Then

TextBox67.Text = format(TextBox67.Text, "$#,##0")

TextBox68.Value = Sheets("IncStmtAssump").Range("e11")
If ComboBox10.Value = "% of Revenue" Then TextBox68.Text =

format(TextBox68.Text, "0.00%")
If ComboBox10.Value = "Input" Then TextBox68.Text =

format(TextBox68.Text, "$#,##0")
If ComboBox10.Value = "% Change from Previous Year" Then

TextBox68.Text = format(TextBox68.Text, "0.00%")
If ComboBox10.Value = "$ Change from Previous Year" Then

TextBox68.Text = format(TextBox68.Text, "$#,##0")

TextBox69.Value = ""
TextBox70.Value = ""
TextBox71.Value = ""

If ComboBox10.Value = "% of Revenue" Then

Sheets("IncStmtAssump").Range("C11:H11").Text =
format(Sheets("IncStmtAssump").Range("C11:H11").Te xt, "0.00%")
If ComboBox10.Value = "Input" Then

Sheets("IncStmtAssump").Range("C11:H11").Text =
format(Sheets("IncStmtAssump").Range("C11:H11").Te xt, "$#,##0")
If ComboBox10.Value = "% Change from Previous Year" Then

Sheets("IncStmtAssump").Range("C11:H11").Text =
format(Sheets("IncStmtAssump").Range("C11:H11").Te xt, "0.00%")
If ComboBox10.Value = "$ Change from Previous Year" Then

Sheets("IncStmtAssump").Range("C11:H11").Text =
format(Sheets("IncStmtAssump").Range("C11:H11").Te xt, "$#,##0")
End Sub



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 Based on cell A text with conditions in Cell B Raicomm Excel Discussion (Misc queries) 0 January 21st 08 04:46 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
Replace based on combobox value Mike[_77_] Excel Programming 1 April 17th 04 02:28 AM
Deleting Rows based on text in cell & formatting cell based on text in column beside it Steve Excel Programming 4 February 26th 04 03:31 PM


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