A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , , , , , , , ,

need help with vba code to input data on certain date and move to next cell for the following date.





 
 
Thread Tools Display Modes
  #1  
Old May 30th 07, 04:37 PM posted to microsoft.public.outlook.program_vba
meghantrus@hotmail.com
external usenet poster
 
Posts: 1
Default need help with vba code to input data on certain date and move to next cell for the following date.

I need to grab data from a pivot table on a worksheet in the same
workbook
and display it in cells on a different worksheet. (keeping the data
static)
This data needs to stay in a specific cell for that day and then it
will be updated with the new numbers in the cell next to it on the
following day.
Currently I am coding this way with If stmts, but would like to use
flags to do this
so static dates do not have to be set in the code (see below).
I am not sure how to do this with flags, I am not very familiar with
flags.
Can anyone help me with this?

Sub UpdateData()

Dim dc As Date ' hold the date from the worksheet
Dim sCellAddress As String ' hold the address of the cell

dc = Worksheets("Daily").Range("A1")

If dc = DateSerial(2007, 4, 4) Then
sCellAddress = "B35"
ElseIf dc = DateSerial(2007, 4, 5) Then
sCellAddress = "C35"
ElseIf dc = DateSerial(2007, 4, 6) Then
sCellAddress = "D35"
End If
Worksheets("Daily").Range(sCellAddress) =
Worksheets("Summary").Range("A2").PivotTable.GetPi votData("mnemonic",
"status", "OK")

Ads
  #2  
Old May 30th 07, 04:45 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,260
Default need help with vba code to input data on certain date and move to next cell for the following date.

Perhaps you meant to post this in an Excel forum, rather than an Outlook discussion group?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message oups.com...
I need to grab data from a pivot table on a worksheet in the same
workbook
and display it in cells on a different worksheet. (keeping the data
static)
This data needs to stay in a specific cell for that day and then it
will be updated with the new numbers in the cell next to it on the
following day.
Currently I am coding this way with If stmts, but would like to use
flags to do this
so static dates do not have to be set in the code (see below).
I am not sure how to do this with flags, I am not very familiar with
flags.
Can anyone help me with this?

Sub UpdateData()

Dim dc As Date ' hold the date from the worksheet
Dim sCellAddress As String ' hold the address of the cell

dc = Worksheets("Daily").Range("A1")

If dc = DateSerial(2007, 4, 4) Then
sCellAddress = "B35"
ElseIf dc = DateSerial(2007, 4, 5) Then
sCellAddress = "C35"
ElseIf dc = DateSerial(2007, 4, 6) Then
sCellAddress = "D35"
End If
Worksheets("Daily").Range(sCellAddress) =
Worksheets("Summary").Range("A2").PivotTable.GetPi votData("mnemonic",
"status", "OK")

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MailItem.Move changes Received Date Frank Perugini Outlook and VBA 1 January 21st 07 11:27 PM
MailItem.Move changes Received Date Frank Perugini Add-ins for Outlook 1 January 21st 07 11:27 PM
Border lines on the side of the date cell partially missing Jerry Outlook - General Queries 6 January 18th 07 09:38 PM
How do I move the date field in an e-mail header? Kozak & Gayer Outlook - Using Forms 1 July 25th 06 09:24 PM
Re-Scheduled events move back to original date CSO Outlook - Calandaring 0 January 9th 06 08:47 PM


All times are GMT +1. The time now is 07:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Online Advertising - Secured Loans - Adverse Credit Remortgage - Ringtones - Bad Credit Mortgages