Adjust numbers on spreadsheet using macro

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
LVL 1
GRiTechAsked:
Who is Participating?
 
Saqib Husain, SyedConnect With a Mentor EngineerCommented:
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
 
Saqib Husain, SyedEngineerCommented:
Setup a button and insert this code

    Columns("N:N").Copy
    Columns("H:H").PasteSpecial Operation:=xlSubtract
0
 
GRiTechAuthor Commented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Saqib Husain, SyedEngineerCommented:
Just that. Nothing else....if you know how to set up a button and code to go with it.
0
 
GRiTechAuthor Commented:
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
 
GRiTechAuthor Commented:
Cool thats brill nearly there, I only want to clear cells N5:N46
0
 
GRiTechAuthor Commented:
Its OK sorted it using

Range ("N3:N46").ClearContents

Thank you for your help
0
 
GRiTechAuthor Commented:
Excellent advise
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.