Re: $$Excel-Macros$$ Convert IF formula to VBA

2014-09-11 Thread 'DanJ' via MS EXCEL AND VBA MACROS
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  >
> *To:* excel-...@googlegroups.com  
> *Cc:* schrein...@att.net  
> *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  >
> *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 

$$Excel-Macros$$ Re: Convert IF formula to VBA

2014-09-11 Thread &#x27;DanJ&#x27; via MS EXCEL AND VBA MACROS
Thank you Bill for the code. Will try it.
Thank you, Paul for your advice. Appreciate it.


Regards,

DanJ
On Wednesday, September 10, 2014 2:35:59 PM UTC+8, DanJ wrote:
>
> 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+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.


Re: $$Excel-Macros$$ Convert IF formula to VBA

2014-09-10 Thread &#x27;DanJ&#x27; via MS EXCEL AND VBA MACROS
Hi,

I would like VBA to perform the test and enter the result.


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  >
> *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+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.


Re: $$Excel-Macros$$ Convert IF formula to VBA

2014-09-10 Thread &#x27;DanJ&#x27; via MS EXCEL AND VBA MACROS
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  >
> *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+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.


$$Excel-Macros$$ Convert IF formula to VBA

2014-09-09 Thread &#x27;DanJ&#x27; via MS EXCEL AND VBA MACROS
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+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.


$$Excel-Macros$$ Re: Shorter way of getting sum of each column using VBA

2014-08-07 Thread &#x27;DanJ&#x27; via MS EXCEL AND VBA MACROS
Hi Pramod and Jef,

Thank you for your quick reply. 
I prefer Jef's solution though.
By the way Jef, what does number "3" mean after "65536".

Thanks again.

DanJ

On Thursday, August 7, 2014 11:20:24 AM UTC+8, DanJ wrote:

> Hello everyone,
>
> I am trying  to get the total of each column K, O, P, T, U, and V using 
> the codes below.
>
> EndRowK = Sheets(1).range("K65536").End(xlUp).Row
>
> Sheets(1).range("K" & EndRowK + 1).Formula = "=SUM(K2:K" & EndRowK & 
> ")"
>
> 
>
> EndRowO = Sheets(1).range("O65536").End(xlUp).Row
>
> Sheets(1).range("O" & EndRowO + 1).Formula = "=SUM(O2:O" & EndRowO & 
> ")"
>
> 
>
> EndRowP = Sheets(1).range("P65536").End(xlUp).Row
>
> Sheets(1).range("P" & EndRowP + 1).Formula = "=SUM(P2:P" & EndRowP & 
> ")"
>
> 
>
> EndRowT = Sheets(1).range("T65536").End(xlUp).Row
>
> Sheets(1).range("T" & EndRowT + 1).Formula = "=SUM(T2:T" & EndRowT & 
> ")"
>
> 
>
> EndRowU = Sheets(1).range("U65536").End(xlUp).Row
>
> Sheets(1).range("U" & EndRowU + 1).Formula = "=SUM(U2:U" & EndRowU & 
> ")"
>
> 
>
> EndRowV = Sheets(1).range("V65536").End(xlUp).Row
>
> Sheets(1).range("V" & EndRowV + 1).Formula = "=SUM(V2:V" & EndRowV & 
> ")"
>
>
> It seems though that there is a shorter way to do this.
>
>
> Please help.
>
>
>
> Thank you.
>
>
>
>

-- 
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.


$$Excel-Macros$$ Shorter way of getting sum of each column using VBA

2014-08-06 Thread &#x27;DanJ&#x27; via MS EXCEL AND VBA MACROS
Hello everyone,

I am trying  to get the total of each column K, O, P, T, U, and V using the 
codes below.

EndRowK = Sheets(1).range("K65536").End(xlUp).Row

Sheets(1).range("K" & EndRowK + 1).Formula = "=SUM(K2:K" & EndRowK & ")"



EndRowO = Sheets(1).range("O65536").End(xlUp).Row

Sheets(1).range("O" & EndRowO + 1).Formula = "=SUM(O2:O" & EndRowO & ")"



EndRowP = Sheets(1).range("P65536").End(xlUp).Row

Sheets(1).range("P" & EndRowP + 1).Formula = "=SUM(P2:P" & EndRowP & ")"



EndRowT = Sheets(1).range("T65536").End(xlUp).Row

Sheets(1).range("T" & EndRowT + 1).Formula = "=SUM(T2:T" & EndRowT & ")"



EndRowU = Sheets(1).range("U65536").End(xlUp).Row

Sheets(1).range("U" & EndRowU + 1).Formula = "=SUM(U2:U" & EndRowU & ")"



EndRowV = Sheets(1).range("V65536").End(xlUp).Row

Sheets(1).range("V" & EndRowV + 1).Formula = "=SUM(V2:V" & EndRowV & ")"


It seems though that there is a shorter way to do this.


Please help.



Thank you.



-- 
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.