A simple droplist to change text atributes

Theo6772

New Member
Joined
Dec 20, 2020
Messages
6
Office Version
  1. 2007
Platform
  1. Windows
The title says the most. I want to make a form to be printed or send by e-mail. It's digital succession of a paper form. The user must strike out three out of four words. This to be achieved bij choosing the correct word shown in a ListBox.
I'm a first time user on VBA and so I get very confused of the masses of samples I have found on so many places.
I would really appreciate the help.
Thanks in advance!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Do you need a real form or VBA?
One very simple solution is Excels Data Validation.

Doing the math: If three out of four words should be stroke out, then there is only one word left. Is this the case?
Then you could make a simple drop-down with four words and the user selects one of them.
2020-12-21 00_32_26-Book2 - Excel.png
 
Upvote 0
Thanks for the reply.
I did think of that. But. It would alter the form. It's an army form that has been around for decades and has an official form number.
1608507788237.png
 
Upvote 0
I found out how to toggle strike out text, but the code has to be modified to be reusable.
RIght now only Cell B5 changes upon selection.

Here is the code:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = Range("B5").Address Then
        Call str
    End If
End Sub

 
Sub str()
        If Range("B5").Font.Strikethrough = True Then
            Range("B5").Font.Strikethrough = False
        Else
            Range("B5").Font.Strikethrough = True
        End If
End Sub

Just paste the code into a worksheet object and click on cell B5.
Then click out of cell B5 and into the cell again.
Each time you click or select cell B5 it will toggle the strikeout

But it's too late now, I'm gonna go to bed.
I'll have a closer look at the code tommorow
 
Upvote 0
I'm happy with all the help I get. There's no rush or deadline to meet. I like to sort things out myself like dealing with a secured worksheet etc.
I just lost it on this one.

I'm going to try out your code to toggle. This is how I created the toggle using a button:

VBA Code:
Private Sub Ocht_Click()
Call VRA_scripts.Unprotect

If Ocht.Value = True Then
    Call VRA_scripts.Ochtend_streep

Else

    Call VRA_scripts.Ochtend_actief

End If
Call VRA_scripts.Protect

End Sub
VBA Code:
Sub Ochtend_streep()
    Range("H6:I6").Select
    With Selection.Font
        .FontStyle = "Standaard"
        .Size = 8
        .Strikethrough = True
        .ThemeFont = xlThemeFontNone
    End With
End Sub
Sub Ochtend_actief()
    Range("H6:I6").Select
    With Selection.Font
        .FontStyle = "Standaard"
        .Size = 8
        .Strikethrough = False
        .ThemeFont = xlThemeFontNone
    End With
End Sub
 
Upvote 0
This is how I created the toggle using a button:

VBA Code:
Private Sub Ocht_Click()
Call VRA_scripts.Unprotect

If Ocht.Value = True Then
    Call VRA_scripts.Ochtend_streep

Else

    Call VRA_scripts.Ochtend_actief

End If
Call VRA_scripts.Protect

End Sub
I have copied your code and set everything up to meet your variables, but nothing happens.

Could you explain two things:

1. what is VRA_scripts ?
2. what is Ocht.Value ?
 
Upvote 0
I have copied your code and set everything up to meet your variables, but nothing happens.

Could you explain two things:

1. what is VRA_scripts ?
2. what is Ocht.Value ?
VRA-scripts is a different Module where the scripts I call are stored. Ocht.value is the status of the toggle switch from the ActiveX board. The switch is named Ocht.
 
Upvote 0
hmmm, that makes things a little bit complicated...

I'll try to start from scratch.
Right now I'm having my first cup of coffee and doing some code improvements...

Hang on a moment and I'll provide you some code for testing.
 
Upvote 0
If you provide me your e-mail address, I can send you the file.
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,166
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top