![]() |
Count using VB
How can I write a macro to count a series of text?
example x,y,z = 3 -- Message posted from http://www.ExcelForum.com |
Count using VB
Hi
not quite sure but maybe sub foo() dim svalue as string dim counter svalue = "x,y,z" counter = len(svalue) - len(replace(svalue,",","")) +1 msgbox counter end sub -- Regards Frank Kabel Frankfurt, Germany "vedrah " schrieb im Newsbeitrag ... How can I write a macro to count a series of text? example x,y,z = 3? --- Message posted from http://www.ExcelForum.com/ |
Count using VB
or maybe
Msgbox worksheetfunction.counta(Range("A1:H1")) -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Frank Kabel" wrote in message ... Hi not quite sure but maybe sub foo() dim svalue as string dim counter svalue = "x,y,z" counter = len(svalue) - len(replace(svalue,",","")) +1 msgbox counter end sub -- Regards Frank Kabel Frankfurt, Germany "vedrah " schrieb im Newsbeitrag ... How can I write a macro to count a series of text? example x,y,z = 3? --- Message posted from http://www.ExcelForum.com/ |
Count using VB
thanks.
but it gets more complicated... I have a series of text many x's , many y's and many z's. So how do I count only the x's, y's and z's? help...... -- Message posted from http://www.ExcelForum.com |
Count using VB
Hi
you may first explain how you have stored these values? - different cells - in a single cell separated by comas -- Regards Frank Kabel Frankfurt, Germany "vedrah " schrieb im Newsbeitrag ... thanks. but it gets more complicated... I have a series of text many x's , many y's and many z's. So how do I count only the x's, y's and z's? help....... --- Message posted from http://www.ExcelForum.com/ |
Count using VB
Hi Frank,
The data is arranged as follows: x a x b x c x d y e y f y g z h z i z j z k z l how do i count items in column A. hope u can help. vedra -- Message posted from http://www.ExcelForum.com |
Count using VB
Hi
msgbox application.worksheetfunction.countif(Range("A1:A1 00"),"x") -- Regards Frank Kabel Frankfurt, Germany "vedrah " schrieb im Newsbeitrag ... Hi Frank, The data is arranged as follows: x a x b x c x d y e y f y g z h z i z j z k z l how do i count items in column A. hope u can help. vedrah --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 07:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com