-
Automatically updating into next cell below
Hi.
I am quite new with VBA. I am currently working on a small project. I created one macro and a button to update Dow Jones Industrial Average stock data from a website. With this data I created a virtual porfolio next to it and the value of the whole portfolio.
Now what i want to do is have a button so that when i press it it would put a current date (say in Sheet 2) and the value of the whole portfolio next to it. Ideally intraday updates will overwrite the portfolio value but will generate a new date and the portfolio value on that day the next day automatically (once i press the button though).
I know it is quite a lot with conditions in the code etc but this would be absolutely perfect.I appreciate any help or link to a possible solution.
Thanks
-
Hi Phaeom,
Welcome to the board To push data from a cell into another cell you just use something to this effect:
[VBA]Sub Example()
ThisWorkbook.Sheet2.Range("A1") = Date
ThisWorkbook.Sheet2.Range("A2").Value = Sheet1.Range("D5").Value
End Sub
[/VBA]
Does that solve the problem?
Cordially,
Aaron
Keep Our Board Clean! - Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
- Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.
-
Hey.
I tried your solution (with dif cell ranges) but it keeps saying:
"Compile error
Method or data member not found"
Highlights .Sheet2 part of the code.I made sure that I have Sheet2 in the workbook.
-
Try
[VBA]Sub Example()
Sheet2.Range("A1") = Date
Sheet2.Range("A2").Value = Sheet1.Range("D5").Value
End Sub[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
It is probably not liking your sheet names, open the Visual Basic Editor (VBE), press ctrl-r to open the Project Explorer. Make sure you are using the Sheet Name not in parentheses.
Cordially,
Aaron
Keep Our Board Clean! - Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
- Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules