Solved

increasing value by 1 in vba excel

Posted on 2014-01-22
2
275 Views
Last Modified: 2014-01-22
Hi,
I am trying to increase a value by 1, and decrease a value by 1 using a vba macro in excel.

i tried to give a go, but having some issues with my code. It's highlighting .Sheets saying "invalid of unqualified reference".

Thanks,

Sub RollDates()
    With .Sheets("F&O Daily")
     .Range("M82").Value = .Range("M82").Value + 1
     .Range("M88").Value = .Range("M88").Value + 1
     MsgBox "Dates Rolled"
End Sub

Open in new window

0
Comment
Question by:jfrank14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
Anthony Berenguel earned 500 total points
ID: 39800703
try
Sub RollDates()
    With Sheets("input")
        .Range("M82").Value = .Range("M82").Value + 1
        .Range("M88").Value = .Range("M88").Value + 1
        MsgBox "Dates Rolled"
     End With
End Sub

Open in new window

0
 

Author Closing Comment

by:jfrank14
ID: 39800770
perfect, thank you!
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

696 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