PDA

View Full Version : Using macro to import stock symbol



Tenspeed39355
11-03-2013, 09:20 AM
I am using a record macro to import date from a financial web site. I am getting an error message on the ACTIVE SHEET PASTE. fuction.
Listed below is he macro. I am stuck.

Sub Macro1()
' Macro1 Macro
Range("A1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Range("A4").Select
Selection.Copy
Application.CutCopyMode = False
Range("B4").Select
ActiveSheet.Paste
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16777216
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("A5").Select
Selection.Copy
Application.CutCopyMode = False
Range("B5").Select
ActiveSheet.Paste
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16777216
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("A6").Select
End Sub

SamT
11-04-2013, 07:42 AM
Same Sub cleaned up.


Sub Macro1()
' Macro1 Macro
Range("A1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Range("A4:A5").Copy Range("B4")
With Range("B4:B5").Font
.Name = "Arial"
.Size = 10
'.Color = -16777216 'This color constant does not exists in Excel 2002
End With
Range("A6").Select
End Sub