ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro_change font style (https://www.excelbanter.com/excel-programming/336780-macro_change-font-style.html)

tommy_gtr[_2_]

macro_change font style
 

hi,

i'm a beginner in macros and now i have a little problem, which is very
easy, but not for me....so please help me....

so i'm trying to write a macro, which will change font style in some
cells to "strikethrough", when i type in other cell "ok".

I wrote a very simply macro and it really works, but I must run it
after i type "ok" in cell to make affect. is there any way to make it
automatically....

Thanks

tommy


--
tommy_gtr
------------------------------------------------------------------------
tommy_gtr's Profile: http://www.excelforum.com/member.php...o&userid=26089
View this thread: http://www.excelforum.com/showthread...hreadid=394180


Tom Ogilvy

macro_change font style
 
Did you check out the link at Chip Pearson's site where this is explained in
pretty good detail?

--
Regards,
Tom Ogilvy

"tommy_gtr" wrote
in message ...

thank you for your answer,

but I'm a really beginner and I tried your code....it works, but first
I must run your macro and then it call my "change font" macro.

but I'm looking for solution, which automatically change my font always
when I typed "ok" in cell (for example in A1).

maybe I pasted your code on incorrect place.

If you have patience with me, please help....

Thanx


--
tommy_gtr
------------------------------------------------------------------------
tommy_gtr's Profile:

http://www.excelforum.com/member.php...o&userid=26089
View this thread: http://www.excelforum.com/showthread...hreadid=394180




dominicb[_85_]

macro_change font style
 

Hi Tommy_gtr

The point about an event procedure is it run's itself at a prespecifie
event - in this case someone changing a workbook. It doesn't need you
intervention.

Have a look at the picture attached. Does that help?

Dominic

+-------------------------------------------------------------------
|Filename: untitled.zip
|Download: http://www.excelforum.com/attachment.php?postid=3680
+-------------------------------------------------------------------

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=39418


tommy_gtr[_3_]

macro_change font style
 

Dear dominicb,

Thank you for your help....now it really works :-)

I'm a new in writing macros, but I need in very short time learn it.
I know that it's not so easy....
Can you recommend me some good links, books, etc.

I will appreciate your every answer.

Have a nice day :-)


--
tommy_gtr
------------------------------------------------------------------------
tommy_gtr's Profile: http://www.excelforum.com/member.php...o&userid=26089
View this thread: http://www.excelforum.com/showthread...hreadid=394180


dominicb[_86_]

macro_change font style
 

Hi Tommy_gtr

I have found the links below helpful (listed in no particular order
with lots of examples on VBA and how to apply it - but that's not t
say that there aren't hundreds of other sites available to help yo
learn.

http://www.cpearson.com/excel/topic.htm
http://j-walk.com/ss/
http://www.contextures.com

John Walkenbach has written a number of books about VBA, aimed at bot
the beginner and the advanced user, so you might like to get one o
those, availabe from his site above, or usually cheaper from Amazon.
The books usually come with a CD with plenty of examples on.

Also, try and use the examples you come across in your own project
because there's no substitute for practice and expreience.

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=39418


tommy_gtr[_4_]

macro_change font style
 

Hi,

thanks.... I'll check all links.

but I'm sure that it's not so easy way which I have chosen.
I have still problem with my little macro ....

I type "ok" and it's change may font style, but only in absolute way.
I'm trying to write it relatively but till now I'm not very succesful.

This is my code:

Sub Macro 1()

ActiveCell.Offset(-1, -9).Range("A1:I1").Select
With Selection.Font
.Name = "Arial CE"
.Size = 9
.Strikethrough = True
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
ActiveCell.Offset(0, 9).Range("A1").Select
End Sub

and I call it with your macro (which I need to write in a relative wa
(I think)):

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target A
Range)
If Range("L41").Value = "OK" Then Call Macro 1
End Su

--
tommy_gt
-----------------------------------------------------------------------
tommy_gtr's Profile: http://www.excelforum.com/member.php...fo&userid=2608
View this thread: http://www.excelforum.com/showthread.php?threadid=39418


tommy_gtr[_5_]

macro_change font style
 

ok,

I worked on my macro and status is:

Sub strikeout()
'
' strikeout Makro
' Makro zaznamenané 10.8.2005, IM
'

ActiveCell.Offset(-1, -9).Range("A1:I1").Select
With Selection.Font
.Name = "Arial CE"
.Size = 9
.Strikethrough = True
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
ActiveCell.Offset(1, 9).Range("A1").Select


End Sub

and call:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target A
Range)
If Target.Value = "OK" Then Call strikeout
End Sub



but now it doesn't depend on where I type my "ok"..... an it's
problem....cause I have one specific column in which I want to typ
ok

--
tommy_gt
-----------------------------------------------------------------------
tommy_gtr's Profile: http://www.excelforum.com/member.php...fo&userid=2608
View this thread: http://www.excelforum.com/showthread.php?threadid=39418



All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com