SUSAN BAXTER
New Member
- Joined
- Apr 1, 2019
- Messages
- 47
Hi, first post. I was wondering if I could get help on developing a macro that would add dollar amounts in a range. Ive looked at formulas but that will not work in this case.
In my research i found the following:
[h=1]Conditional Logic in VBA[/h] In the most of programming specific sections of code are executed depending on the result of one or more conditions. For checking a condition a series of keywords and operators that can be combined are provided. Checking a condition produces a True or a False result. Depending on the result the statements following the then are executed or passed over. The execution continues in the following branch either in the else block (which is usually optional), or if there is no else branch, then after the end If. Conditional Statements are the If ....Then statement, with the Else or ElseIf, and the Select case statement.
I need the macro to search in the cell ranges G1:G100, K1:K100, P1:P100 (every cell is formatted as a numbers, 5.00, 7.00, 25.00 etc.). My condition for a true result would be the next two columns to the right of the range cell must have figures in them. Note: the first column to the right is formatted as text, if that matters, so column H,L and Q. The third columns I, M and R are formatted as numbers.
An example would be in cell G4 has the figure 25.00 in it, in cell H4 has a 2-25 in it and cell I15 has a 5.00 in it. Since cell G4 has two cells the right of it that have figures in them it would be a true condition. The macro would then search the cell range A1:A20,D1:D20 (which has numbers 1.00 to 40.00 in consecutive order) to match the number 25.00 (cell D25) and then write 5.00 from cell I4 to the cell to the right of it which is E5. After that continue through the rest of the range.
This will save me a ton of time. Thanks
<style type="text/css">h1 { margin-bottom: 0.21cm; direction: ltr; color: rgb(0, 0, 0); text-align: left; }h1.western { font-family: "Liberation Serif", sans-serif; }h1.cjk { font-family: "WenQuanYi Micro Hei"; font-size: 24pt; }h1.ctl { font-family: "Lohit Devanagari"; font-size: 24pt; }p { margin-bottom: 0.25cm; direction: ltr; color: rgb(0, 0, 0); line-height: 115%; text-align: left; }p.western { font-family: "Liberation Serif", serif; font-size: 12pt; }p.cjk { font-family: "WenQuanYi Micro Hei"; font-size: 12pt; }p.ctl { font-family: "Lohit Devanagari"; font-size: 12pt; }a:link { }</style>
In my research i found the following:
[h=1]Conditional Logic in VBA[/h] In the most of programming specific sections of code are executed depending on the result of one or more conditions. For checking a condition a series of keywords and operators that can be combined are provided. Checking a condition produces a True or a False result. Depending on the result the statements following the then are executed or passed over. The execution continues in the following branch either in the else block (which is usually optional), or if there is no else branch, then after the end If. Conditional Statements are the If ....Then statement, with the Else or ElseIf, and the Select case statement.
I need the macro to search in the cell ranges G1:G100, K1:K100, P1:P100 (every cell is formatted as a numbers, 5.00, 7.00, 25.00 etc.). My condition for a true result would be the next two columns to the right of the range cell must have figures in them. Note: the first column to the right is formatted as text, if that matters, so column H,L and Q. The third columns I, M and R are formatted as numbers.
An example would be in cell G4 has the figure 25.00 in it, in cell H4 has a 2-25 in it and cell I15 has a 5.00 in it. Since cell G4 has two cells the right of it that have figures in them it would be a true condition. The macro would then search the cell range A1:A20,D1:D20 (which has numbers 1.00 to 40.00 in consecutive order) to match the number 25.00 (cell D25) and then write 5.00 from cell I4 to the cell to the right of it which is E5. After that continue through the rest of the range.
This will save me a ton of time. Thanks
<style type="text/css">h1 { margin-bottom: 0.21cm; direction: ltr; color: rgb(0, 0, 0); text-align: left; }h1.western { font-family: "Liberation Serif", sans-serif; }h1.cjk { font-family: "WenQuanYi Micro Hei"; font-size: 24pt; }h1.ctl { font-family: "Lohit Devanagari"; font-size: 24pt; }p { margin-bottom: 0.25cm; direction: ltr; color: rgb(0, 0, 0); line-height: 115%; text-align: left; }p.western { font-family: "Liberation Serif", serif; font-size: 12pt; }p.cjk { font-family: "WenQuanYi Micro Hei"; font-size: 12pt; }p.ctl { font-family: "Lohit Devanagari"; font-size: 12pt; }a:link { }</style>