Solved

Adjust numbers on spreadsheet using macro

Posted on 2013-01-25
8
306 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now