Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make this into a toggle command? [XL2003]
I have a simple script that works only okay when going in one
direction, putting a strikethrough when on a particular line: With Selection.Font .Strikethrough = True End With I needed to be able to have a script firstly, behave in a toggle fashion - i.e., press the button and the strikethrough is applied, press the button and it's taken off. Then it would be good to have this work on any given line one is on that it puts the strikethrough on that line for the 2 columns in that spreadsheet for that line, columns A and B. What code would do this pls? I have only one spreadsheet that applies a border line with various "attributes", I think they'd be called (certain line style, colour, etc.) but it applies to a top border and no amount of working with the code has yielded what I need. I seem to still be a junior at all this even after all this time! <sheepish grin Thank you! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make this into a toggle command? [XL2003]
On Nov 11, 6:44*am, StargateFan wrote:
I have a simple script that works only okay when going in one direction, putting a strikethrough when on a particular line: * * With Selection.Font * * * * .Strikethrough = True * * End With I needed to be able to have a script firstly, behave in a toggle fashion - i.e., press the button and the strikethrough is applied, press the button and it's taken off. Then it would be good to have this work on any given line one is on that it puts the strikethrough on that line for the 2 columns in that spreadsheet for that line, columns A and B. What code would do this pls? *I have only one spreadsheet that applies a border line with various "attributes", I think they'd be called (certain line style, colour, etc.) but it applies to a top border and no amount of working with the code has yielded what I need. *I seem to still be a junior at all this even after all this time! *<sheepish grin Thank you! Sub togglestrikethru() 'selected cell(s) Selection.Font.Strikethrough = _ Not Selection.Font.Strikethrough End Sub Sub togglestrikethruCOLS() 'columns a:b mr = ActiveCell.Row Cells(mr, 1).Resize(, 2).Font.Strikethrough = _ Not Cells(mr, 1).Resize(, 2).Font.Strikethrough End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make this into a toggle command? [XL2003]
Does one row, two columns - starting from the top left selected cell...
With Selection.Resize(1, 2).Font .Strikethrough = Not .Strikethrough End With -- Jim Cone Portland, Oregon USA http://www.mediafire.com/PrimitiveSoftware .. .. .. "StargateFan" wrote in message ... I have a simple script that works only okay when going in one direction, putting a strikethrough when on a particular line: With Selection.Font .Strikethrough = True End With I needed to be able to have a script firstly, behave in a toggle fashion - i.e., press the button and the strikethrough is applied, press the button and it's taken off. Then it would be good to have this work on any given line one is on that it puts the strikethrough on that line for the 2 columns in that spreadsheet for that line, columns A and B. What code would do this pls? I have only one spreadsheet that applies a border line with various "attributes", I think they'd be called (certain line style, colour, etc.) but it applies to a top border and no amount of working with the code has yielded what I need. I seem to still be a junior at all this even after all this time! <sheepish grin Thank you! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make this into a toggle command? [XL2003]
Those will err with mixed content. I suggest reading one cell only:
Sub A() 'selected cell(s) Selection.Font.Strikethrough = _ Not Selection(1).Font.Strikethrough End Sub Sub B() Selection.Resize(1, 2).Font.Strikethrough = _ Not Selection(1).Font.Strikethrough End Sub Best wishes Harald "Jim Cone" wrote in message ... Does one row, two columns - starting from the top left selected cell... With Selection.Resize(1, 2).Font .Strikethrough = Not .Strikethrough End With -- Jim Cone Portland, Oregon USA http://www.mediafire.com/PrimitiveSoftware . . . "StargateFan" wrote in message ... I have a simple script that works only okay when going in one direction, putting a strikethrough when on a particular line: With Selection.Font .Strikethrough = True End With I needed to be able to have a script firstly, behave in a toggle fashion - i.e., press the button and the strikethrough is applied, press the button and it's taken off. Then it would be good to have this work on any given line one is on that it puts the strikethrough on that line for the 2 columns in that spreadsheet for that line, columns A and B. What code would do this pls? I have only one spreadsheet that applies a border line with various "attributes", I think they'd be called (certain line style, colour, etc.) but it applies to a top border and no amount of working with the code has yielded what I need. I seem to still be a junior at all this even after all this time! <sheepish grin Thank you! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make this into a toggle command? [XL2003]
Harald,
Glad you are still hanging around. Thanks. '-- Jim Cone "Harald Staff" wrote in message . .. Those will err with mixed content. I suggest reading one cell only: Sub A() 'selected cell(s) Selection.Font.Strikethrough = _ Not Selection(1).Font.Strikethrough End Sub Sub B() Selection.Resize(1, 2).Font.Strikethrough = _ Not Selection(1).Font.Strikethrough End Sub Best wishes Harald "Jim Cone" wrote in message ... Does one row, two columns - starting from the top left selected cell... With Selection.Resize(1, 2).Font .Strikethrough = Not .Strikethrough End With -- Jim Cone Portland, Oregon USA http://www.mediafire.com/PrimitiveSoftware |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make this into a toggle command? [XL2003]
I'm so very, very sorry, but on trying out all these suggestions -
they all work lovely, thank you - I realized that I shouldn't make this toggable. Of course, when I tested it, I mis-clicked and saw how too easy it was to reset something that shouldn't be reset. Glad I figured this out now rather than later <g, though. This sheet is to keep track of items that need to get done so we must be absolutely sure that only accomplished items get the strikethrough. So the button should turn the strikethrough on only, after all. And a separate script with value to false can be accessed by the user manually so that taking the strikethrough off is done on purpose and never by mistake. Phew. Good to figure that out. So I thought it would be easy to figure out how to get the vb code to apply the strikethrough to columns A and B on the which one is on but, blunderwoman strikes again, I can't figure it out. I've spent the last 40 minutes on the archives of this ng and nothing. The only spreadsheet I have that applies formatting to a row in a similar manner deals with the borders so I don't know how to change it to deal with the font and text within a cell. So the simple code seems to still be good: With Selection.Font .Strikethrough = True End With Just need to change the above so that strikethrough is applied to columns A and B of the active row. Thanks so much! :oD |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make this into a toggle command? [XL2003]
Sub DoneAlready()
Dim Rw As Long Rw = ActiveCell.Row Range(Cells(Rw, 1), Cells(Rw, 2)).Font.Strikethrough = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
toggle or command and how | Excel Programming | |||
Command Button That Will Toggle | Excel Programming | |||
Xl2003: Validation.Add method gives error from Command Button | Excel Programming | |||
Xl2003: Validation.Add method gives error from Command Button | Excel Programming | |||
Toggle command buttons | Excel Programming |