Font strikethrough

G

Guest

Hi,

How can i coded in vba to check whether the column of two words in the cells
has the font strikrthrough equal to true and append the word in cell with "is
strikethrough".
example: column a column b column d
apple apple apple is strikethough


where apple is strike through.

thanks,

regards,
Ben
 
G

Guest

Hi
try
with activesheet.range("A1")
if .Font.Strikethrough or .offset(0,1).Font.Strikethrough then
.offset(0,3).value="is strikethrough"
end if
end with
 
G

Guest

Hi Frank,
Thanks, it works well. Can it be used in the range of cells for example from
range "a2:a400"?
how do u coded in vba?

thanks.

regards,
Ben
 
D

Dave Peterson

How about:

Option Explicit
Sub testme01()
Dim myCell As Range

For Each myCell In ActiveSheet.Range("A1:A400").Cells
With myCell
If .Font.Strikethrough _
Or .Offset(0, 1).Font.Strikethrough Then
.Offset(0, 3).Value = "is strikethrough"
End If
End With
Next myCell


End Sub
 
G

Guest

Hi,

Can it be checked that for the range of the cell(a2:a400), some of the cell
may not necessary contained the strikethrough word? can it be done?

thanks,

regards,
Ben
 
D

Dave Peterson

Do you mean some of the cells are strikethrough and some aren't strikethrough?

Or do you mean some of the words in each cell are strikethrough and some are not
(possibly a mixture of both)???

I'm guessing you meant the mixture within the cell.

And just A2:A400,

Option Explicit
Sub testme01()
Dim myCell As Range

For Each myCell In ActiveSheet.Range("A2:A400").Cells
With myCell
If .Font.Strikethrough = False Then
'not there
Else
'either True or null
.Offset(0, 3).Value = "is strikethrough"
End If
End With
Next myCell

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top