View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sheela sheela is offline
external usenet poster
 
Posts: 43
Default Updating data automatically using macro

Hello,

I created a link between two worksheet in the same
workbook using macro. The main worksheet where the data
is entered should update certain columns in another
worksheet.

When the macro is run, it should do the updation
automatically but its not working. Below is the macro
which I created. I really don't know what's wrong with it.

-----------
Sub DailyMOPS()
Application.Goto Reference:="mthProdDateRange"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("A5").Select
ActiveSheet.Paste
Application.Goto Reference:="mthULG97Range"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("B5").Select
ActiveSheet.Paste
Application.Goto Reference:="mthULG92Range"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("C5").Select
ActiveSheet.Paste
Application.Goto Reference:="mthKeroRange"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("D5").Select
ActiveSheet.Paste
Application.Goto Reference:="mthGORange"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("E5").Select
ActiveSheet.Paste
Application.Goto Reference:="mthGO25Range"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("F5").Select
ActiveSheet.Paste
Application.Goto Reference:="mthNaphthaRange"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("G5").Select
ActiveSheet.Paste
Application.Goto Reference:="mth180Range"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("H5").Select
ActiveSheet.Paste
Application.Goto Reference:="mthLSWRCrkRange"
Selection.Copy
Windows("MOPS.xls").Activate
Sheets("Daily MOPS").Select
Range("I5").Select
ActiveSheet.Paste
Range("A5:I30").Select
Selection.Sort Key1:=Range("A5"),
Order1:=xlDescending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:= _
xlTopToBottom
ActiveWorkbook.Save
xltohtml
End Sub
------------------

Please help.

Thanks,
Sheela