ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Interrogating cells by cell formatting (https://www.excelbanter.com/excel-worksheet-functions/47181-interrogating-cells-cell-formatting.html)

Bhupinder Rayat

Interrogating cells by cell formatting
 
Hi all

Is there anyway I can interrogate cells by what formatting they have?

For example, can I use an IF statement that tells excel to return the value
of a cell if it has a bold format, or otherwise return nothing?

I have a huge table of data that I have imported from word, that I need to
manipulate.

Any help would be much appreciated.


Regards,


Pinda.

Ian

You can with a macro. eg

Sub CopyIfBold()
For r = 1 To 10
If Cells(r, 1).Font.Bold = True Then
Cells(r, 2).Value = Cells(r, 1)
End If
Next r
End Sub

This copies values in column 1 (A) rows 1 to 10 to the corresponding cell in
column 2 (B) if the font in A is bold.

--
Ian
--
"Bhupinder Rayat" wrote in
message ...
Hi all

Is there anyway I can interrogate cells by what formatting they have?

For example, can I use an IF statement that tells excel to return the
value
of a cell if it has a bold format, or otherwise return nothing?

I have a huge table of data that I have imported from word, that I need to
manipulate.

Any help would be much appreciated.


Regards,


Pinda.




Bhupinder Rayat

Ian,

works like a dream. I can now edit the code to give me exactly what i want.
thank you for your help!


Pinda.

"Ian" wrote:

You can with a macro. eg

Sub CopyIfBold()
For r = 1 To 10
If Cells(r, 1).Font.Bold = True Then
Cells(r, 2).Value = Cells(r, 1)
End If
Next r
End Sub

This copies values in column 1 (A) rows 1 to 10 to the corresponding cell in
column 2 (B) if the font in A is bold.

--
Ian
--
"Bhupinder Rayat" wrote in
message ...
Hi all

Is there anyway I can interrogate cells by what formatting they have?

For example, can I use an IF statement that tells excel to return the
value
of a cell if it has a bold format, or otherwise return nothing?

I have a huge table of data that I have imported from word, that I need to
manipulate.

Any help would be much appreciated.


Regards,


Pinda.






All times are GMT +1. The time now is 05:59 AM.

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