Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Public Function IsStrikeThrough(rng As Range)


I tried to use the code below to sort the range of cells in column A s
that the strikethrough characters can be sorted to the top.

I used these steps but it failed to run. Appreciate if someone ca
help. Thanks a lot.
1) Open Excel.
2) Right click on the Sheet1 name tab.
3) Select View Code.
4) Copy the code and paste it over the top of the Sheet1 code window.
5) Press Alt+Q to return to Excels normal view.
6) Push Alt+F8, but there is no macro name I can select select to Run




Public Function IsStrikeThrough(rng As Range)
Application.Volatile
IsStrikeThrough = rng.Font.Strikethrough
End Function


Use this in an adjacent column and use that as the first sort key

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Public Function IsStrikeThrough(rng As Range)

William,

The code should be placed in a standard code module, not the Sheet1 code
module. In the VBA editor, go to the Insert menu and choose 'Module'.
Place the code in that module. Moreover, the code is a Function procedure,
not a Sub procedure, so it won't show up in the Macro dialog box. The
function is intended to be called from a worksheet cell. E.g.,

=IsStrikeThrough(A1)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"William Poh Ben" wrote in
message ...

I tried to use the code below to sort the range of cells in column A so
that the strikethrough characters can be sorted to the top.

I used these steps but it failed to run. Appreciate if someone can
help. Thanks a lot.
1) Open Excel.
2) Right click on the Sheet1 name tab.
3) Select View Code.
4) Copy the code and paste it over the top of the Sheet1 code window.
5) Press Alt+Q to return to Excels normal view.
6) Push Alt+F8, but there is no macro name I can select select to Run.




Public Function IsStrikeThrough(rng As Range)
Application.Volatile
IsStrikeThrough = rng.Font.Strikethrough
End Function


Use this in an adjacent column and use that as the first sort key.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Public Function IsStrikeThrough(rng As Range)

I am not sure where you got those step.

Open Excel

Open the workbook and go to the worksheet where you want to sort.

do Alt+F11
in the menu do insert = Module

in the resulting module, paste in the code


Public Function IsStrikeThrough(rng As Range)
Application.Volatile
IsStrikeThrough = rng.Font.Strikethrough
End Function

do Alt+F11 to get back to Excel

go to the dummy column and put in

=IsStrikeThrough(A2)

in row 2 for example then drag fill down.

Sort on this column as the first key. use other columns for second and
third key if appropriate.

--
Regards,
Tom Ogilvy



"William Poh Ben" wrote in
message ...

I tried to use the code below to sort the range of cells in column A so
that the strikethrough characters can be sorted to the top.

I used these steps but it failed to run. Appreciate if someone can
help. Thanks a lot.
1) Open Excel.
2) Right click on the Sheet1 name tab.
3) Select View Code.
4) Copy the code and paste it over the top of the Sheet1 code window.
5) Press Alt+Q to return to Excels normal view.
6) Push Alt+F8, but there is no macro name I can select select to Run.




Public Function IsStrikeThrough(rng As Range)
Application.Volatile
IsStrikeThrough = rng.Font.Strikethrough
End Function


Use this in an adjacent column and use that as the first sort key.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Public Function IsStrikeThrough(rng As Range)


Hi Tom,

you are my saviour !
Thank you so much

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Public Function Remarks TKS_Mark Excel Discussion (Misc queries) 2 September 23rd 08 07:12 PM
Public Function Question Carl Excel Worksheet Functions 7 August 31st 06 08:15 PM
Using A Public Function / carl Excel Worksheet Functions 1 April 6th 06 09:13 PM
Public Function Problems Andy123 Excel Discussion (Misc queries) 3 December 27th 05 10:11 AM
Public Function Monty Excel Discussion (Misc queries) 9 December 24th 04 06:35 PM


All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"