Hi Paul,

Got it! Idea taken from the Code sent by Bill.

Here's my code and it works perfectly fine for my need.


Sub AgingofReceivables()
 
    Application.ScreenUpdating = False
 
    ActiveSheet.range("A2").Select
    
    Do While ActiveCell.value <> "" 'checking if the cell is not blank
        
        If ActiveCell.value <= 0 Then ActiveCell.Offset(0, 1).value = 
"Current"
        If ActiveCell.value > 0 Then ActiveCell.Offset(0, 1).value = "1 to 
30 days"
        If ActiveCell.value > 30 Then ActiveCell.Offset(0, 1).value = "31 
to 60 days"
        If ActiveCell.value > 60 Then ActiveCell.Offset(0, 1).value = 
"61-90 days"
        If ActiveCell.value > 90 Then ActiveCell.Offset(0, 1).value = 
"91-180 days"
        If ActiveCell.value > 180 Then ActiveCell.Offset(0, 1).value = "181 
days up"
        
        ActiveCell.Select 'goes back to A2
        ActiveCell.Offset(1, 0).Select ' goes to the next row
    Loop
            
    Application.ScreenUpdating = True

End Sub

Thank you again!

Best regards,

DanJ




On Thursday, September 11, 2014 8:52:35 PM UTC+8, Paul Schreiner wrote:
>
> No problem, once you've asked and answered a couple hundred questions 
> you'll get an idea of what part of what is in your head needs to be shared 
> to get the answer you're looking for!
>  
> It looks like Mr. Bill has provided a Change_Event macro that could work 
> for what you want to do.
>  
> In case you're not familiar, there are several ways a VBA macro can be 
> "invoked".
>  
> You can use the Macros icon in the developer tab and select your macro.
>  
> You can create a button.
>  
> You can write the macro as a public function. This is also referred to as 
> a "User Defined Function" (UDF).
> you would then be able to insert a formula in a cell like:
> =TestVal(A2) and have it return the test result.
>  
> Or you can, as Mr. Bill provided, create a macro that executes whenever a 
> change is made to a sheet.
> His macro tests to see if the cell changed is cell "A2",
> then evaluates the cell value.
>  
> It depends upon not only what you want to do, but how you  want to do it.
>  
> Once again, in your mind you have a "vision" or concept of how you want 
> something to work.
> The more you of that vision you can share, the closer the answer will be 
> to what you were trying to accomplish.
>  
> Otherwise, the missing information relies on assumptions made by the mind 
> of others. Which, in some cases can be an adventure in itself!
>  
> let us know if you need additional assistance.
>  
> *Paul*
> -----------------------------------------
>
>
>
>
>
>
>
> *“Do all the good you can,By all the means you can,In all the ways you 
> can,In all the places you can,At all the times you can,To all the people 
> you can,As long as ever you can.” - John Wesley*
> -----------------------------------------
>
>    *From:* 'DanJ' via MS EXCEL AND VBA MACROS <excel-...@googlegroups.com 
> <javascript:>>
> *To:* excel-...@googlegroups.com <javascript:> 
> *Cc:* schrein...@att.net <javascript:> 
> *Sent:* Wednesday, September 10, 2014 10:38 PM
> *Subject:* Re: $$Excel-Macros$$ Convert IF formula to VBA
>  
> Hi Paul,
>
> Sorry, if my question is vague.
>
> I would like VBA to perform the test and enter the result.
>
> Thanks.
>
>
> DanJ
>
> On Wednesday, September 10, 2014 7:24:49 PM UTC+8, Paul Schreiner wrote:
>
> Are you saying that:
> 1) you'd like to use VBA to insert the =IF() statement?
> 2) or that you'd like VBA to perform the test and enter the result? 
> 3) or that you'd like a VBA function to perform the test and return 
> the result?
>  
> *Paul*
> ------------------------------ -----------
>
>
>
>
>
>
>
> *“Do all the good you can,By all the means you can,In all the ways you 
> can,In all the places you can,At all the times you can,To all the people 
> you can,As long as ever you can.” - John 
> Wesley*------------------------------ 
> -----------
>
>    *From:* 'DanJ' via MS EXCEL AND VBA MACROS <excel-...@googlegroups.com 
> >
> *To:* excel-...@googlegroups.com 
> *Sent:* Wednesday, September 10, 2014 2:35 AM
> *Subject:* $$Excel-Macros$$ Convert IF formula to VBA
>  
> Dear Everyone,
>
> I want to categorize age of receivables based on the number of days due 
> using the formula below. The formula is in cell B2.
>
>
> =IF(A2>=180,"181 days up",IF(A2>90,"91-180 days",IF(A2>60,"61-90 
> days",IF(A2>30,"31 to 60 days",IF(A2>0,"1 to 30 
> days",IF(A2<=0,"Current"))))))
>
>
> How do I convert said formula to VBA and populate the same to the next 
> succeeding rows. 
>
>
> Thank you in advance for your help.
>
>
> DanJ
>
> -- 
> 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...@ googlegroups.com.
> To post to this group, send email to excel-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>
>
>   -- 
> 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...@googlegroups.com <javascript:>.
> To post to this group, send email to excel-...@googlegroups.com 
> <javascript:>.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>
>
>  

-- 
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/d/optout.

Reply via email to