Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Report with macro losing links to a particular worksheet after running macro

Hello All,

I have written the following macro (although I am still new to writing
macros) to run a report. However, after running the macro, the links
between two particular worksheets are missing i.e. cells are getting
copy paste special - values.

However, before running the macro it is perfectly okay. Can anyone
please help me?
-------------------------------------------------------------------------------------------------------------------------------
Declare Function EssVConnect Lib "ESSEXCLN.XLL" (ByVal sheetName As
Variant, ByVal username As Variant, ByVal password As Variant, ByVal
server As Variant, ByVal application As Variant, ByVal database As
Variant) As Long
Declare Function EssVRetrieve Lib "ESSEXCLN.XLL" (ByVal sheetName As
Variant, ByVal range As Variant, ByVal lockFlag As Variant) As Long
Declare Function EssVSetSheetOption Lib "ESSEXCLN.XLL" (ByVal
sheetName As Variant, ByVal item As Variant, ByVal sheetOption As
Variant) As Long
Declare Function EssVZoomIn Lib "ESSEXCLN.XLL" (ByVal sheetName As
Variant, ByVal range As Variant, ByVal selection As Variant, ByVal
level As Variant, ByVal across As Variant) As Long

Sub RunMacro()
Dim cubename As String
cubename = "Rank - Scenario 2"
X = EssVConnect(cubename, "", "", "Agfrpdap1.Ea.Com", cubename,
cubename)
If X < 0 Then
MsgBox ("Connection failure.")
End If
Sheets("Rank - Scenario 1").Select
X = EssVSetSheetOption(Null, 1, 1)
X = EssVSetSheetOption(Null, 2, True)
X = EssVSetSheetOption(Null, 6, True)
X = EssVSetSheetOption(Null, 7, True)
X = EssVZoomIn(Null, Null, range("a6"), 1, False)
Sheets("Rank - Scenario 1").Select
range("A6").Select
range(selection, selection.End(xlDown)).Select
range(selection, selection.End(xlToRight)).Select
selection.Sort Key1:=range("D6"), Order1:=xlDescending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortTextAsNumbers
X = EssVSetSheetOption(Null, 2, False)
X = EssVZoomIn(Null, Null, range("a7:a1000"), 1, False)
range("A6").Select
range(selection, selection.End(xlDown)).Select
range(selection, selection.End(xlToRight)).Select
selection.Sort Key1:=range("D6"), Order1:=xlDescending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortTextAsNumbers
selection.Copy
Sheets("Rank - Scenario 2").Select
range("a6").Select
ActiveSheet.Paste
range("A6").Select
range(selection, selection.End(xlDown)).Select
range(selection, selection.End(xlToRight)).Select
selection.Sort Key1:=range("h6"), Order1:=xlDescending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortTextAsNumbers
Sheets("Report Control").Select
range("a2").Select
MsgBox ("The Macro has successfully run.")
End Sub
---------------------------------------------------------------------------------------------------------------------------------
Regards,
Prasanth Dangeti

Reply
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
running a macro on another worksheet BRC Excel Programming 2 December 27th 06 08:15 PM
Editing a worksheet while running a macro Dan Perkins Excel Programming 3 October 11th 06 04:04 AM
saved worksheet opens in new with macro error report margaret Excel Worksheet Functions 0 April 19th 06 11:56 AM
Running macro on the perticular worksheet only vanessa h[_3_] Excel Programming 3 January 25th 06 10:41 AM
Update links to other workbooks while running macro [email protected] Excel Programming 5 July 28th 05 06:17 AM


All times are GMT +1. The time now is 02:17 PM.

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

About Us

"It's about Microsoft Excel"