Solved

Adjust numbers on spreadsheet using macro

Posted on 2013-01-25
8
309 Views
Last Modified: 2013-01-25
Hi

I have a spreadsheet which has qtys of printer toners used in H:H

When I have a toner delivery I want to enter toners delivered in N:N

I then want to be able to push a button on the spreadsheet and the macro will deduct N:N from H:H and then clear the cells in N:N ready for the next toner delivery.

How do I do this

Office 2010
0
Comment
Question by:GRiTech
  • 5
  • 3
8 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38818524
Setup a button and insert this code

    Columns("N:N").Copy
    Columns("H:H").PasteSpecial Operation:=xlSubtract
0
 
LVL 1

Author Comment

by:GRiTech
ID: 38818549
Thanks for quick reply do I insert it just like that

 Columns("N:N").Copy
    Columns("H:H").PasteSpecial Operation:=xlSubtract

or is there other bits of code needed

Cheers
G
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38818564
Just that. Nothing else....if you know how to set up a button and code to go with it.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 1

Author Comment

by:GRiTech
ID: 38818651
OK that seems to work but it clears the fill colour assigned to column H:H also it doesnt clear the cells in N:N at the end

Cells in N:N are left selected
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 38818684
Sorry did not read the question closely enough.

    Columns("N:N").Copy
    Columns("H:H").PasteSpecial Paste:=xlPasteValues, Operation:=xlSubtract
    Columns("N:N").ClearContents
0
 
LVL 1

Author Comment

by:GRiTech
ID: 38818879
Cool thats brill nearly there, I only want to clear cells N5:N46
0
 
LVL 1

Author Comment

by:GRiTech
ID: 38819093
Its OK sorted it using

Range ("N3:N46").ClearContents

Thank you for your help
0
 
LVL 1

Author Closing Comment

by:GRiTech
ID: 38819096
Excellent advise
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question