Re: VBA Historical Price Data Loop
JP,
Here's some code that I put together this morning. You can see how it works on the attached workbook by simply doubleclicking any cell in sheet1.
HTH
m
Re: VBA Historical Price Data Loop
JP,
Here's some code that I put together this morning. You can see how it works on the attached workbook by simply doubleclicking any cell in sheet1.
HTH
m
Re: VBA Historical Price Data Loop
JP,
Sorry to let you down, I normally use VBA as a last resort since Excel has so many powerful features built into its immediate environment - plus VBA is really not my strong point.
So attached is yet another formula-based solution. I've used the OFFSET/SUMPRODUCT combination to identify the correct computational ranges - with a couple of dynamic ranges thrown in for improved formula readability.
I'm hopeful that this will satisfy your needs vis-a-vis AVG, STDEV, auto-filter etc. etc. But this is really the edge of my creativity.
HTH
m
Re: VBA Historical Price Data Loop
Hi JP,
If you're willing to settle for a slightly different reporting format, then here's a suggestion that doesn't require VBA:
1. In column (D), you could simply place an analyst code (or generate dummy entries via formulas- see attached workbook).
2. Run up a Pivot table, with Security Names and Years as row fields, and Analyst codes as column fields
3. Forecast EPS should be dropped as data items (with Average i/o Sum function)
See attached workbook for details.
HTH
m
Re: Copying data from the Internet
Norie's suggestion sounds pretty painless - deleting blanks should take < 30 secs.
Quote
Can you not just goto Edit>Goto...Special... and select blanks then delete?
You could even set it up as a macro to further speed it up.
BTW, how are you parsing the data after downloading?
m
Re: checking appearance of a number, and telling the col num
Yeah! I see it now. Dunno why I got the whacky message earlier.
I'm a bit puzzled seeing your columns going right to left i/o left to right. However, this looks like a VBA problem to me - not my strong point. Hope one of the gurus here will solve this for you. Good Luck!
m
Re: protecting my codes from change
Hi xlite,
Can the hacks bypass passwords that are 20+ characters in length?
m
Re: see if a number is not repeated, and when it is where is it located
Hi mordor,
When I click the link to your attachment, I get the following message:
Quote
Invalid Attachment specified. If you followed a valid link, please notify the webmaster
m
Re: prorate with macro
Hi opeyemi1,
Assuming that row #1 in Sheet1 contains the field headings/titles, and data begins from row 2, then try this formula in cell C2
=B2/SUMIF(A:A,A2,B:B)*VLOOKUP(A2,Sheet2!$A:$B,2,FALSE)
The attached workbook shows direct and indirect approaches to the prorata problem.
HTH
m
Re: Copying data from the Internet
Hi Richard,
Instead of using the Paste command, try using PasteSpecial > Values (or Text). It works for me when I download large amounts of financial stats (S&P 500 cos) from various websites.
HTH
m
Re: Return Row reference for each cell in selection
Hi Neiluk66,
Without knowing the exact nature of your problem, all I can suggest is the following code, which allows you to cycle through each cell in your selection, and shows the address (you could do other stuff with it too).
Sub Each_Cell_In_Selection()
Selection.SpecialCells(xlCellTypeVisible).Select
For Each a In Selection
MsgBox a.Address
Next
End Sub
HTH
m
Re: Append data (values) from one sheet to another - and apply formats
Hi Maqbool,
Thanks for the code. Although I couldn't use it as-is, however with a little tweaking I was able to get it to do what I wanted.
Thanks again.
m
Re: Append data (values) from one sheet to another - and apply formats
Thanks Maqbool.
Your code works great as long as I'm appending a single record. However, in case of 2 or more records, the formatting is copied only to the first appended record. The rest of them carry the general format.
Any thoughts on overcoming this?
m
Re: In Column F make all dates 'X' days passed into Italic font
Hi DJC,
The cause of the error is that one or more cells in column F contain "non-date" data. Try this modified code.
Sub Past7Days()
Dim RngCell As Range
On Error Resume Next
For Each RngCell In Range("F1", Range("F65536").End(xlUp))
If Date - RngCell >= 7 Then
RngCell.Font.Italic = True
End If
Next
End Sub
HTH
m
Re: Append data (values) from one sheet to another - and apply formats
Bump!
File attached for reference.
Any help would be highly appreciated.
m
Re: Cell's Value vs Text Property
Fantastic!
A million thanks to everyone!
m
Re: Cell's Value vs Text Property
Thanks Norie.
m
Hi,
I have a macro in Sheet1 that selects data and appends values to Sheet2
Here's my code:
Private Sub CommandButton1_Click()
If IsEmpty(Range("A2")) Then Exit Sub
Range("A2", ActiveCell.SpecialCells(xlCellTypeLastCell)).Copy
Sheets("Sheet2").Range("A65536").End(xlUp).Offset(1, 0) _
.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Range("A2", ActiveCell.SpecialCells(xlCellTypeLastCell)) _
.ClearContents
End Sub
The formatting in both sheets is different (Sheet2 contains conditional formatting). Therefore, I cannot simply bring in formats from Sheet1 into Sheet2.
I need some code that will apply the formats from the last row of the data in Sheet2 (prior to append) to the newly appended data.
Thanks.
m
Hi,
What's the difference between using a cell's .Value property or .Text property? Results of both these properties appear to be identical. For example, I entered the number 100 in cell A1 and ran the following code:
The end-result in both cases was 10 (the square root of 100). So why do we have two properties when one would do just fine?
I'd appreciate an explanation in layman terms. What I'd appreciate even more are examples of situations when using one property is more beneficial than using the other.
Thanks.
m
Re: sequence formula to infinity
I may be over-simplifying here but how about this scheme?
1. Write in the first seven days - say in cells A1 thru A7
2. In cell A8, write the formula to refer to A1 (=A1)
3. The formula in A8 may be copied down as many times as desired (within a total count of 65536, of course.)
HTH
m