?
Solved

increasing value by 1 in vba excel

Posted on 2014-01-22
2
Medium Priority
?
285 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 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
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.

777 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