| Windows 7: Need To Create A Macro! |
15 Jun 2012
|
#1 | | |
Need To Create A Macro! I currently have a spreadsheet that I use to record monthly payments, so that I can see how much my new balance is and how many more payments I have left. There are several different items over several rows in the table on the spreadsheet, so when I have made a payment I have to work out each individual item and then change the corresponding column. All the items are at different levels of being paid off and they all have different monthly amounts that need to be paid off, so it can take a while and get quite repetitive. Is there a way that I can record a macro that will allow me to just press a button and the amounts are all reduced and then shown in the correct column automatically? | My System Specs |
| System Manufacturer/Model Number Dell Inspiron OS Windows 7 CPU 2.4 GHz Intel i3 cpu Memory 8GB Mouse MS Explorer Mouse Internet Speed 100 Mb/s |
22 Jun 2012
|
#3 | | Windows 8 Pro Standish, Lancashire, England |
Please dont post shortened urls on the forum, it makes it much harder to spot malicious links. | My System Specs | | Computer type PC/Desktop System Manufacturer/Model Number doofenshmirtz evil incorporated OS Windows 8 Pro CPU Intel Core i7-3970X Extreme Edition Motherboard ASRock X79 EXTREME11 Memory 32GB (8x4GB) Corsair DDR3 Dominator Platinum Graphics Card 2x 3GB EVGA GTX 660 Ti Superclocked+ Sound Card Creative Monitor(s) Displays 3 x27" Dell & 2 x 23" Dell Screen Resolution 3 @ 2560x1440 & 2 @ 1920x1080 Keyboard Microsoft Ergononic 7000 Mouse Logitech Performance MX PSU 1500W ThermalTake Toughpower Case Thermaltake Level 10 GT Cooling Antec Kúhler H2O 620 CPU Watercooler Hard Drives 240GB Intel 520 Series, 2.5" SSD, SATA III
Intel X25-M SSD - 160GB Internet Speed 34 Mb/s ADSL2+ (Bonded) Antivirus Windows Defender, Malwarebytes Pro Browser Firefox Other Info WinTV NovaTD
HP CP1515n Color Laser
Sony BD-5300S-0B Blu-ray Writer
Microsoft LifeCam Cinema
APC 750i Smart UPS |
22 Jun 2012
|
#4 | | Win 7 Ultimate (64-bit), Win 7 Pro (32-bit) N. Calif |

Quote: Originally Posted by BomberAF I currently have a spreadsheet that I use to record monthly payments, so that I can see how much my new balance is and how many more payments I have left. There are several different items over several rows in the table on the spreadsheet, so when I have made a payment I have to work out each individual item and then change the corresponding column. All the items are at different levels of being paid off and they all have different monthly amounts that need to be paid off, so it can take a while and get quite repetitive. Is there a way that I can record a macro that will allow me to just press a button and the amounts are all reduced and then shown in the correct column automatically? Can you post an example of what you are trying to do?
Are the payments the same every month? Are they paid on the same day? If so, it would be fairly trivial to write a macro that would allow you to press a button that would automatically decrement each column by the set monthly payment. Things get a little more involved if the payment is different each month and/or the various payments are made on different days.
If any of these things that are being paid down involve interest, that's another level of complexity.
(I'm extremely jealous of your internet DL speed!) | My System Specs | | System Manufacturer/Model Number Home Built, Dell Inspiron 1520 Laptop OS Win 7 Ultimate (64-bit), Win 7 Pro (32-bit) CPU 3.4Ghz 3770K i7, 2.4Ghz Core 2 Duo Motherboard Gigabyte Z77X-UD3H, Dell Memory 8G, 3G Graphics Card ATI Radeon HD 5770, Mobile Intel 965 Sound Card High Definition Audio (Built-in to mobo) Monitor(s) Displays Dell 2409W 24" Screen Resolution 1920x1080 Keyboard IBM Model M - used continuously since 1986 Mouse Microsoft PSU Antec Case Antec 100 Cooling CM 212+ Hard Drives 128G SSD OS; 1.5T & 2T Data on Desktop, 320G for laptop Internet Speed 1.5M down 1.2M up :-( Other Info Also have an Acer Aspire netbook, a home-built AMD Dual core (Minecraft server) and home-built Pent 4 all running Win 7. Also have various machines running XP, Win Server 2K, Win Server 2003, Linux and DOS. I think I have a problem... |
23 Jun 2012
|
#5 | | |
Need To Create A Macro! 
Quote: Originally Posted by strollin 
Quote: Originally Posted by BomberAF I currently have a spreadsheet that I use to record monthly payments, so that I can see how much my new balance is and how many more payments I have left. There are several different items over several rows in the table on the spreadsheet, so when I have made a payment I have to work out each individual item and then change the corresponding column. All the items are at different levels of being paid off and they all have different monthly amounts that need to be paid off, so it can take a while and get quite repetitive. Is there a way that I can record a macro that will allow me to just press a button and the amounts are all reduced and then shown in the correct column automatically? Can you post an example of what you are trying to do?
Are the payments the same every month? Are they paid on the same day? If so, it would be fairly trivial to write a macro that would allow you to press a button that would automatically decrement each column by the set monthly payment. Things get a little more involved if the payment is different each month and/or the various payments are made on different days.
If any of these things that are being paid down involve interest, that's another level of complexity.
(I'm extremely jealous of your internet DL speed!)
Thanks for the reply, here is the table that I want to create a macro for:
As you can see there are a number of different payment that all take place on the same day. The payments don't change each month but each item has a different payment.
I am happy with my download speed but my upload is only at 5mbs but shall go to 10 by the end of the year once Virgin Media have finished boosting everyone's speed. I also find it strange the being in California the richest state in the richest country in the world you don't seem to have very fast broadband.
Last edited by BomberAF; 23 Jun 2012 at 08:32 AM..
| My System Specs | | System Manufacturer/Model Number Dell Inspiron OS Windows 7 CPU 2.4 GHz Intel i3 cpu Memory 8GB Mouse MS Explorer Mouse Internet Speed 100 Mb/s |
23 Jun 2012
|
#6 | | Win 7 Ultimate (64-bit), Win 7 Pro (32-bit) N. Calif |
Here's a quick and dirty macro that will do what you want: Code: Sub pay_bills()
For x = 4 To 10
If Worksheets(1).Cells(x, 5) >= 0 Then
Worksheets(1).Cells(x, 5).Value = (Worksheets(1).Cells(x, 5).Value - Worksheets(1).Cells(x, 4).Value)
If Worksheets(1).Cells(x, 5) <= 0 Then
Worksheets(1).Cells(x, 4).Value = 0
End If
End If
Next
End Sub You can go into the Visual Basic Editor and Add a module to the first worksheet then copy this code into it and save it. You can then assign a key combo (such as Ctrl-p) to run the macro. After that, every month when you pay your bills just press your assigned key combo to update the values. | My System Specs | | System Manufacturer/Model Number Home Built, Dell Inspiron 1520 Laptop OS Win 7 Ultimate (64-bit), Win 7 Pro (32-bit) CPU 3.4Ghz 3770K i7, 2.4Ghz Core 2 Duo Motherboard Gigabyte Z77X-UD3H, Dell Memory 8G, 3G Graphics Card ATI Radeon HD 5770, Mobile Intel 965 Sound Card High Definition Audio (Built-in to mobo) Monitor(s) Displays Dell 2409W 24" Screen Resolution 1920x1080 Keyboard IBM Model M - used continuously since 1986 Mouse Microsoft PSU Antec Case Antec 100 Cooling CM 212+ Hard Drives 128G SSD OS; 1.5T & 2T Data on Desktop, 320G for laptop Internet Speed 1.5M down 1.2M up :-( Other Info Also have an Acer Aspire netbook, a home-built AMD Dual core (Minecraft server) and home-built Pent 4 all running Win 7. Also have various machines running XP, Win Server 2K, Win Server 2003, Linux and DOS. I think I have a problem... |
23 Jun 2012
|
#7 | | |

Quote: Originally Posted by strollin Here's a quick and dirty macro that will do what you want: Code: Sub pay_bills()
For x = 4 To 10
If Worksheets(1).Cells(x, 5) >= 0 Then
Worksheets(1).Cells(x, 5).Value = (Worksheets(1).Cells(x, 5).Value - Worksheets(1).Cells(x, 4).Value)
If Worksheets(1).Cells(x, 5) <= 0 Then
Worksheets(1).Cells(x, 4).Value = 0
End If
End If
Next
End Sub You can go into the Visual Basic Editor and Add a module to the first worksheet then copy this code into it and save it. You can then assign a key combo (such as Ctrl-p) to run the macro. After that, every month when you pay your bills just press your assigned key combo to update the values. Thanks for that, I am just about to have my dinner, so when I have finished I will give that a bash.
Cheers | My System Specs | | System Manufacturer/Model Number Dell Inspiron OS Windows 7 CPU 2.4 GHz Intel i3 cpu Memory 8GB Mouse MS Explorer Mouse Internet Speed 100 Mb/s |
23 Jun 2012
|
#8 | | |
Can you confirm some points for me please.
So the Sub pay_bils(), is the name of the macro you are about to create.
The spreadsheet is on worksheet 3 so I can just use worksheet 3 instead of the name I have used on the spreadsheet.
I don't understand the command 'If Worksheets(1).Cells(x, 5) >= 0 Then'. Do I have to replace x with the corresponding column.
I also don't understand where you get the number 5 from, so can you please explain this a bit more for me if you don't mind.
Sorry for being a pain, but your help is greatly appreciated. | My System Specs | | System Manufacturer/Model Number Dell Inspiron OS Windows 7 CPU 2.4 GHz Intel i3 cpu Memory 8GB Mouse MS Explorer Mouse Internet Speed 100 Mb/s |
23 Jun 2012
|
#9 | | |
Got this sorted now, working a treat!
Got it working with the help if this gem of a forum http://www.excelforum.com/ I am sure the MODS wont mind this link being posted as it is a great site for EXCEL problems.
Many thanks all I got the solution from this forum but many thanks to all who helped. | My System Specs | | System Manufacturer/Model Number Dell Inspiron OS Windows 7 CPU 2.4 GHz Intel i3 cpu Memory 8GB Mouse MS Explorer Mouse Internet Speed 100 Mb/s |
25 Jun 2012
|
#10 | | |
Hi BomberAF,
Glad to hear that you got it working,
Regards,
Rajeev
Dell | Social Media and Outreach| | My System Specs | | Need To Create A Macro! problems? All times are GMT -5. The time now is 05:54 AM. | |