LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Macro to open file, load & do charts, functional but not usable/not a good prog


I have been working on this for a while, after using help, recorded I
have something but it is not quite OK. I would like someone to look at
code and chop the ugly parts and help me make it work all together fine.
When I run the macro to do charts, it works fine. but when i run the
browse command and load file this way I cannot ran charts. Thanks for
your expert guys/gals.
My macro has two buttoms 1, to let you search(browse) for your file,
the other to run the charts.
Email:

Private Sub CommandButton1_Click()
Call Browser
End Sub


Private Sub RunChart_Click()
Call IFMBOW
End Sub

Sub IFMBOW()
'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+p
'

Dim F_cell As Range
Dim L_cell As Range
Dim F1 As String
Dim L1 As String


Set F_cell = Cells.Find(what:="@da$sha_x")
Set L_cell = Cells.FindPrevious().Next

F1 = F_cell.Address([ReferenceStyle:=xlA1])
L1 = L_cell.Address([ReferenceStyle:=xlA1])


Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range(F1 & ":" &
L1), PlotBy:=xlColumns


ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
..HasTitle = True
..ChartTitle.Characters.Text = "@dA$SHA_X"
..Axes(xlCategory, xlPrimary).HasTitle = False
..Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveWindow.Visible = False
Windows("Book1.xls").Activate
'Range("m10").Select

Set F_cell = Nothing
Set L_cell = Nothing
F1 = 0
L1 = 0


Set F_cell = Cells.Find(what:="@da$sha_y")
Set L_cell = Cells.FindPrevious().Next

F1 = F_cell.Address([ReferenceStyle:=xlA1])
L1 = L_cell.Address([ReferenceStyle:=xlA1])


Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range(F1 & ":" &
L1), PlotBy:=xlColumns

ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
..HasTitle = True
..ChartTitle.Characters.Text = "@dA$SHA_Y"
..Axes(xlCategory, xlPrimary).HasTitle = False
..Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveWindow.Visible = False
Windows("Book1.xls").Activate

'Range("j45").Select



End Sub

Sub Browser()

Dim lngCount As Long

' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
..AllowMultiSelect = True
..Show

' Display paths of each file selected
For lngCount = 1 To 1 '.SelectedItems.Count
'MsgBox .SelectedItems(lngCount)
Workbooks.Open Filename:=.SelectedItems(lngCount)

Set NewSheet = Sheets.Add(Type:=xlWorksheet)
For i = 1 To Sheets.Count
NewSheet.Cells(i, 1).Value = Sheets(i)
Next i

Next lngCount

End With

End Sub


--
osman
------------------------------------------------------------------------
osman's Profile:
http://www.excelforum.com/member.php...o&userid=34226
View this thread: http://www.excelforum.com/showthread...hreadid=542477

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open non-Office prog. macro Schneider_4 Excel Programming 4 October 5th 07 07:51 PM
clicking shortcut opens excel prog, but not highlighted file-why? cavanman Excel Discussion (Misc queries) 1 March 6th 07 11:52 PM
when double clicking on .xls files, prog. opens but not the file David Azzo Setting up and Configuration of Excel 2 October 4th 06 02:49 PM
download will not open in usable form CHMM Excel Worksheet Functions 0 June 18th 05 08:31 PM
Macro to load on open Steve Chatham[_2_] Excel Programming 6 February 11th 04 07:20 PM


All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"