![]() |
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 |
All times are GMT +1. The time now is 07:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com