Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
REQ Help with simple Excel macro
Hi there -
I haven't played around with macros much before and need to ask what must be an extremely simple question. I want to create a toolbar button in Excel (this is Excel 2003) to put a tick in a cell. I recorded a macro of the action (below) but while it puts a u-umlaut character in the selected cell, it only applies the right font formatting to cell D7 (where the cursor happened to be at time of recording) and leaves the current cell as is, whereas it needs to be in the Wingdings font. I seem to remember in an older version of Office (95?), when you went in to Record Macro it asked if you wanted to use absolute or relative cell references, which might have done the trick, but that option seems to have been moved or removed now. And I know no VBA, not even enough to make basic changes to the macro. Can anyone please help? Many thanks! Sub Tick() ' ' Tick Macro ' Macro recorded 01/08/2007 ' ' ActiveCell.FormulaR1C1 = "ü" Range("D7").Select With Selection.Font ..Name = "Wingdings" ..Size = 10 ..Strikethrough = False ..Superscript = False ..Subscript = False ..OutlineFont = False ..Shadow = False ..Underline = xlUnderlineStyleNone ..ColorIndex = xlAutomatic End With Selection.Font.Bold = True End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
REQ Help with simple Excel macro
Hi Olórin, hope this helps... ;0)
This will leave the cursor where it is but change the values of "I7" Sub Tick() ' Range("I7") = "ü" With Range("I7").Font .Name = "Wingdings" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Bold = True End With End Sub Best regards, Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
REQ Help with simple Excel macro
Try this:
************ Sub Tick() With ActiveCell.Offset(0, -1) .FormulaR1C1 = "ü" .Font.Name = "Wingdings" .Font.Size = 10 .Font.Bold = True End With End Sub ************* Change the values in the Offset to put the tick mark wherever you want (in relation to the activecell) -- as is, the tick-mark will be one cell to the LEFT of the activecell. OR, to put the tick-mark IN the activecell, just delete the Offset property altogether ... br//ray |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
REQ Help with simple Excel macro
Thanks, but "always I7" isn't a huge improvement on "always D7"... or am I
missing something? "Les Stout" wrote in message ... Hi Olórin, hope this helps... ;0) This will leave the cursor where it is but change the values of "I7" Sub Tick() ' Range("I7") = "ü" With Range("I7").Font .Name = "Wingdings" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Bold = True End With End Sub Best regards, Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
REQ Help with simple Excel macro
Thanks, Ray - I get the picture now. All working fine.
"Ray" wrote in message ups.com... Try this: ************ Sub Tick() With ActiveCell.Offset(0, -1) .FormulaR1C1 = "ü" .Font.Name = "Wingdings" .Font.Size = 10 .Font.Bold = True End With End Sub ************* Change the values in the Offset to put the tick mark wherever you want (in relation to the activecell) -- as is, the tick-mark will be one cell to the LEFT of the activecell. OR, to put the tick-mark IN the activecell, just delete the Offset property altogether ... br//ray |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
REQ Help with simple Excel macro
Hi,
Just Change the "I7" for the cell where you want the Tick to be. Sub Tick() ' Range("I7") = "ü"With Range("I7").Font'<== And here... .Name = "Wingdings" .Size = 10 .Bold = True End With End Sub Best regards, Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Simple Excel Macro | New Users to Excel | |||
Help with a simple Excel macro | Excel Programming | |||
simple excel macro Q | Excel Programming | |||
simple excel vba macro | Excel Programming | |||
Simple Excel Macro - Please Help | Excel Programming |