Fastest way to learn is try to learn from queries posted here in forum. I
have learned VBA thru forum participation.

Thanks for Acknowledgement.

You can paste code in This workbook so as to get result in all sheet.

Alternatively, you can also use in standard module where you have to run
this code each time manually. Insted of status bar you can use Msg box.

here goes code:

Sub atest()

    Dim rng As Range
    Dim wrk As Double
    Dim tot As Double
    Dim hly As Double
    Dim nCol As Long
    Dim nRow As Long
    Dim cell As Range
    Application.StatusBar = False

    With ThisWorkbook.Worksheets("sheet1")

    Set rng = Selection
    nCol = rng.Columns.Count
    nRow = rng.Rows.Count
    tot = nCol * nRow
    wrk = 0
    hly = 0
    intColl = ActiveCell.Column + nCol - 1
    intRoww = ActiveCell.Row + nRow - 1


        For Each cell In rng

                If cell.Value = "V" Then
                wrk = wrk + 1
                End If

                If cell.Value = "E" Then
                wrk = wrk + 1
                End If

                If cell.Value = "F" Then
                        hly = hly + 1
                End If

                If cell.Value = "A" Then
                        hly = hly + 1
                End If


        Next cell
    End With
    MsgBox "Work =" & wrk & " Holidays =" & hly & " total days=" & tot
End Sub




Thanks!!


On Fri, Jun 28, 2013 at 6:59 PM, Thiago Souza <souza...@gmail.com> wrote:

> Very nice, Thank You. I would never get there. I only know the basic
> programming language for fortran from eng. School. How do I learn VBA like
> that? Any book you recommend?
>
> Backing to work, I made the total days dont count the blank cells, for now
> everything is perfect. Thank ou so much for your help. Soon I'll need more
> help on a similar subject, I hope you can Help. Now I'll try to fit in my
> real sheets..... Have a nice weakend
>
>
>
> 2013/6/28 VBA VABZ <v...@vabs.in>
>
>>  Hi
>>
>> PFA..
>>
>> Values will be updated in Status Bar..
>>
>>
>> Cheers...
>>
>>
>> On Thu, Jun 27, 2013 at 11:41 PM, Thiago Souza <souza...@gmail.com>wrote:
>>
>>>  I need some help with a code to the workbook uploaded. I'm having a
>>> hard time in finding a way to start!
>>> The workbook is to control day works of employes where they cannot work
>>> more than 183 days in the last 365 continuous days.
>>> I need a code where based on the selected cell it shows me anywhere in
>>> the sheet how many days the employe worked in the last 365 days and how
>>> many days off he had, this way it will be possible to plan how many days I
>>> can use someones work without extrapolate the limit easyer then counting
>>> manually every time I need to do that.
>>> E= work
>>> F= day off
>>> V= trip (same as work)
>>>
>>> If some arrangement need to be done to make the code easier its ok.
>>>
>>> I started thinking in using a countif, but i didint know how to make
>>> count works backwards 365 days based on the selected cell.
>>>
>>> Then now i'm trying to use a matrix and array to store the values then
>>> based on the cell, but i'm also having trouble in make it work on the 3
>>> years range as shown on the file uploaded.
>>>
>>> Thank You all,
>>> Sorry for my bad english, I'm trying to improve!
>>>
>>> --
>>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be?
>>> It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
>>> https://www.facebook.com/discussexcel
>>>
>>> FORUM RULES
>>>
>>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>>> will not get quick attention or may not be answered.
>>> 2) Don't post a question in the thread of another member.
>>> 3) Don't post questions regarding breaking or bypassing any security
>>> measure.
>>> 4) Acknowledge the responses you receive, good or bad.
>>> 5) Jobs posting is not allowed.
>>> 6) Sharing copyrighted material and their links is not allowed.
>>>
>>> NOTE : Don't ever post confidential data in a workbook. Forum owners and
>>> members are not responsible for any loss.
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "MS EXCEL AND VBA MACROS" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to excel-macros+unsubscr...@googlegroups.com.
>>>
>>> To post to this group, send email to excel-macros@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/excel-macros.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
>> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
>> https://www.facebook.com/discussexcel
>>
>> FORUM RULES
>>
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>> will not get quick attention or may not be answered.
>> 2) Don't post a question in the thread of another member.
>> 3) Don't post questions regarding breaking or bypassing any security
>> measure.
>> 4) Acknowledge the responses you receive, good or bad.
>> 5) Jobs posting is not allowed.
>> 6) Sharing copyrighted material and their links is not allowed.
>>
>> NOTE : Don't ever post confidential data in a workbook. Forum owners and
>> members are not responsible for any loss.
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "MS EXCEL AND VBA MACROS" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/excel-macros/OfH4sa4ciaI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> excel-macros+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to excel-macros@googlegroups.com.
>> Visit this group at http://groups.google.com/group/excel-macros.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Thiago Souza
>
> --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to the Google Groups
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to excel-macros+unsubscr...@googlegroups.com.
> To post to this group, send email to excel-macros@googlegroups.com.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to