Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Question On Formatting cells

Heloo
Can anyone plzz help me to get this code below working.....All I am looking for is to add another button to custom format toolbar and put my own format.....Any ideas help greatly appreciated...

Sub MakeCustomFormatDisplay()
Dim Tbar As CommandBar
Dim NewBtn As CommandBarButton
On Error Resume Next
CommandBars("Custom Format").Delete
On Error GoTo 0

Set Tbar = CommandBars.Add
With Tbar
..Name = "Custom Format"
..Visible = True
End With
Set NewBtn = CommandBars("Custom Format").Controls.Add(Type:=msoControlButton)
With NewBtn
..Caption = " "
..OnAction = "FormatChanger"
..TooltipText = "Click to change the Custom format"
..Style = msoButtonCaption
End With
Call UpdateToolbar
End Sub
Sub UpdateToolbar()
On Error Resume Next
CommandBars("Custom Format").Controls(1).Caption = ActiveCell.CustomFormat
End Sub
Sub FormatChanger()
Dim r As Range

For Each r In Selection

Select Case r.Value
Case 1
r.Value = "Read Only"
Case 2
r.Value = "Assessor"
Case 3
r.Value = "Reviewer"

End Select

Next

Call UpdateToolbar
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Question On Formatting cells

I changed the last to this:

Sub FormatChanger()
Dim r As Range

For Each r In Selection

If IsNumeric(r.Value) Then
Select Case r.Value
Case 1
r.Value = "Read Only"
Case 2
r.Value = "Assessor"
Case 3
r.Value = "Reviewer"

End Select
End If
Next

Call UpdateToolbar
End Sub

Other than that, it worked ok for me.

I am not sure what UpdateToolbar is supposed to do or what
activecell.customformat is supposed to produce.

--
Regards,
Tom Ogilvy

"excelnaive" wrote in message
...
Heloo,
Can anyone plzz help me to get this code below

working.....All I am looking for is to add another button to custom format
toolbar and put my own format.....Any ideas help greatly appreciated...


Sub MakeCustomFormatDisplay()
Dim Tbar As CommandBar
Dim NewBtn As CommandBarButton
On Error Resume Next
CommandBars("Custom Format").Delete
On Error GoTo 0

Set Tbar = CommandBars.Add
With Tbar
.Name = "Custom Format"
.Visible = True
End With
Set NewBtn = CommandBars("Custom

Format").Controls.Add(Type:=msoControlButton)
With NewBtn
.Caption = " "
.OnAction = "FormatChanger"
.TooltipText = "Click to change the Custom format"
.Style = msoButtonCaption
End With
Call UpdateToolbar
End Sub
Sub UpdateToolbar()
On Error Resume Next
CommandBars("Custom Format").Controls(1).Caption = ActiveCell.CustomFormat
End Sub
Sub FormatChanger()
Dim r As Range

For Each r In Selection

Select Case r.Value
Case 1
r.Value = "Read Only"
Case 2
r.Value = "Assessor"
Case 3
r.Value = "Reviewer"

End Select

Next

Call UpdateToolbar
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Question On Formatting cells

Hi Tom
Thanks for the reply....I am trying to add another button to the custom format menu that stores my format which 1-read only,2-assessor,3-reviewer.I got this code from a excel book which talked about assigning a custom format to a built in button thats why I have the toolbar thing....I am not sure if my code is correct or not...but this is what I want to get....Any advices revisions greatly appreciated...

Thanks again...

----- Tom Ogilvy wrote: ----

I changed the last to this

Sub FormatChanger(
Dim r As Rang

For Each r In Selectio

If IsNumeric(r.Value) The
Select Case r.Valu
Case
r.Value = "Read Only
Case
r.Value = "Assessor
Case
r.Value = "Reviewer

End Selec
End I
Nex

Call UpdateToolba
End Su

Other than that, it worked ok for me

I am not sure what UpdateToolbar is supposed to do or wha
activecell.customformat is supposed to produce

--
Regards
Tom Ogilv

"excelnaive" wrote in messag
..
Heloo
Can anyone plzz help me to get this code belo

working.....All I am looking for is to add another button to custom forma
toolbar and put my own format.....Any ideas help greatly appreciated..
Sub MakeCustomFormatDisplay(

Dim Tbar As CommandBa
Dim NewBtn As CommandBarButto
On Error Resume Nex
CommandBars("Custom Format").Delet
On Error GoTo
Set Tbar = CommandBars.Ad

With Tba
.Name = "Custom Format
.Visible = Tru
End Wit
Set NewBtn = CommandBars("Custo

Format").Controls.Add(Type:=msoControlButton
With NewBt
.Caption = "
.OnAction = "FormatChanger
.TooltipText = "Click to change the Custom format
.Style = msoButtonCaptio
End Wit
Call UpdateToolba
End Su
Sub UpdateToolbar(
On Error Resume Nex
CommandBars("Custom Format").Controls(1).Caption = ActiveCell.CustomForma
End Su
Sub FormatChanger(
Dim r As Rang
For Each r In Selectio
Select Case r.Valu

Case
r.Value = "Read Only
Case
r.Value = "Assessor
Case
r.Value = "Reviewer
End Selec
Nex
Call UpdateToolba

End Su




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
condionally formatting based on another cells formatting? Derrick Excel Discussion (Misc queries) 2 July 31st 09 08:05 PM
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
Formatting Question Matt Excel Discussion (Misc queries) 2 May 15th 08 10:43 PM
Formatting Question Zecarioca Excel Discussion (Misc queries) 4 August 23rd 06 10:30 PM
Formatting Question Carey Abercrombie Excel Worksheet Functions 5 February 23rd 06 07:40 PM


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