ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Repeat (https://www.excelbanter.com/excel-programming/415054-repeat.html)

Dave

Repeat
 
Hi, I got the code below to calculate sales tax on invoices. For example in
cell C7 I enter the net invoice amount of $100. Then I run the macro and it
enters in
cell D7 $6.75, and in E7 it totals it to $106.75.

I don't know anything about coding, so don't assume anything with me. What
I want
the macro to do is that once it calculates the sales tax and total invoice
amount in Row 7, is to go to the next row down cell C8. From here I then
enter the net invoice amount and I want to repeat the macro again.

I can't figure this out. Thanks for any input.



Macro3 Macro
' Sales Tax
'
' Keyboard Shortcut: Ctrl+f
'
Range("D7").Select
Range("D7") = "=0.0675*RC[-1]"

Range("E7").Select
Range("E7") = "=RC[-2]+RC[-1]"



End Sub




Wigi

Repeat
 
Hi

In fact, it's not terribly difficult ;-)

Macro3 Macro
' Sales Tax
'
' Keyboard Shortcut: Ctrl+f
'
Range("D" & ActiveCell.Row).Formula = "=0.0675*RC[-1]"
Range("E" & ActiveCell.Row).Formula = "=RC[-2]+RC[-1]"
Range("D" & ActiveCell.Row + 1).Select

End Sub


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Dave" wrote:

Hi, I got the code below to calculate sales tax on invoices. For example in
cell C7 I enter the net invoice amount of $100. Then I run the macro and it
enters in
cell D7 $6.75, and in E7 it totals it to $106.75.

I don't know anything about coding, so don't assume anything with me. What
I want
the macro to do is that once it calculates the sales tax and total invoice
amount in Row 7, is to go to the next row down cell C8. From here I then
enter the net invoice amount and I want to repeat the macro again.

I can't figure this out. Thanks for any input.



Macro3 Macro
' Sales Tax
'
' Keyboard Shortcut: Ctrl+f
'
Range("D7").Select
Range("D7") = "=0.0675*RC[-1]"

Range("E7").Select
Range("E7") = "=RC[-2]+RC[-1]"



End Sub




Bob Phillips[_3_]

Repeat
 
Enter all the amounts in C7 down and then run this code

Sub AddFormulae()
Dim LastRow As Long

With Activesheet

LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
Range("D7").Resize(LastRow - 6).Formula = "=C7*6.75%"
Range("E7").Resize(LastRow - 6).Formula = "=C7+D7
End With
End Sub

All done in one hit.

--
__________________________________
HTH

Bob

"Dave" wrote in message
...
Hi, I got the code below to calculate sales tax on invoices. For example
in
cell C7 I enter the net invoice amount of $100. Then I run the macro and
it
enters in
cell D7 $6.75, and in E7 it totals it to $106.75.

I don't know anything about coding, so don't assume anything with me.
What
I want
the macro to do is that once it calculates the sales tax and total invoice
amount in Row 7, is to go to the next row down cell C8. From here I then
enter the net invoice amount and I want to repeat the macro again.

I can't figure this out. Thanks for any input.



Macro3 Macro
' Sales Tax
'
' Keyboard Shortcut: Ctrl+f
'
Range("D7").Select
Range("D7") = "=0.0675*RC[-1]"

Range("E7").Select
Range("E7") = "=RC[-2]+RC[-1]"



End Sub






Dave

Repeat
 
Thanks so much, that was great stuff.

"Bob Phillips" wrote:

Enter all the amounts in C7 down and then run this code

Sub AddFormulae()
Dim LastRow As Long

With Activesheet

LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
Range("D7").Resize(LastRow - 6).Formula = "=C7*6.75%"
Range("E7").Resize(LastRow - 6).Formula = "=C7+D7
End With
End Sub

All done in one hit.

--
__________________________________
HTH

Bob

"Dave" wrote in message
...
Hi, I got the code below to calculate sales tax on invoices. For example
in
cell C7 I enter the net invoice amount of $100. Then I run the macro and
it
enters in
cell D7 $6.75, and in E7 it totals it to $106.75.

I don't know anything about coding, so don't assume anything with me.
What
I want
the macro to do is that once it calculates the sales tax and total invoice
amount in Row 7, is to go to the next row down cell C8. From here I then
enter the net invoice amount and I want to repeat the macro again.

I can't figure this out. Thanks for any input.



Macro3 Macro
' Sales Tax
'
' Keyboard Shortcut: Ctrl+f
'
Range("D7").Select
Range("D7") = "=0.0675*RC[-1]"

Range("E7").Select
Range("E7") = "=RC[-2]+RC[-1]"



End Sub








All times are GMT +1. The time now is 07:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com