Solved

Adjust numbers on spreadsheet using macro

Posted on 2013-01-25
8
307 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
Outlook Free & Paid Tools
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

920 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

14 Experts available now in Live!

Get 1:1 Help Now