Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default EVALUATE Method and arguments

the following code confused me. Can someone explain to me what I am setting
VSetting to.
vSetting = Application.Evaluate( _
"'" & wksSheet.Name & "'!" & _
rngName.Value)

Also what does "'"& wksSheet.Name&"!" refer to
what does setting Vsetting = Empty do?

Finally, could you give me an explanation of the evaluate method with an
example for context.

Entire code below for context. Thanks for the help

Public Sub ReadSettings()

Dim lOffset As Long
Dim rngName As Range
Dim rngNameList As Range
Dim rngSetting As Range
Dim sMsg As String
Dim vSetting As Variant
Dim uAnswer As VbMsgBoxResult
Dim wkbBook As Workbook
Dim wksSheet As Worksheet

' This process is irreversible. Warn the user before
' clearing the existing contents of the table.
uAnswer = vbNo
sMsg = "Do you want to overwrite the table with" _
& vbLf & "the current template settings?"
uAnswer = MsgBox(sMsg, vbQuestion + vbYesNo)

If uAnswer = vbYes Then

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Set wkbBook = Application.Workbooks(msFILE_TIME_ENTRY)

wksUISettings.UsedRange.Offset(1, 0).Clear

wkbBook.Activate
Set rngNameList = wksUISettings.Range(msRNG_NAME_LIST)

For Each wksSheet In wkbBook.Worksheets

lOffset = lOffset + 1

With wksUISettings.Range("A1").Offset(lOffset, 0)

.Value = wksSheet.CodeName
'MsgBox wksUISettings.Range("A1").Offset(lOffset, 0).Value =
wksSheet.CodeName

For Each rngName In rngNameList

Set rngSetting = Intersect(.EntireRow, _
rngName.EntireColumn)

' The setScrollArea setting requires special
' treatment because it's a named range as
' opposed to a named constant.
If rngName.Value = "setScrollArea" Then

' This setting may not exist,
' therefore we wrap it in
' On Error Resume Next.
On Error Resume Next
rngSetting.Value = _
wksSheet.Range("setScrollArea").Address
On Error GoTo 0

Else

vSetting = Empty
vSetting = Application.Evaluate( _
"'" & wksSheet.Name & "'!" & _
rngName.Value)

If Not IsError(vSetting) Then
rngSetting.Value = vSetting
End If

End If

Next rngName

End With

Next wksSheet

ThisWorkbook.Activate
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End If

End Sub
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
Please post this thread a correct full method, method about Nast Runsome New Users to Excel 8 February 25th 08 03:29 PM
Please post this thread a complete correct method, method about te Nast Runsome New Users to Excel 0 February 23rd 08 09:42 PM
Strange (?) Evaluate Method Behavior Johnny Meredith Excel Worksheet Functions 0 March 3rd 06 02:28 PM
GetObject method not work after Call Shell Method ben Excel Programming 8 February 21st 06 03:45 PM
Why QUIT method doesn't work after COPY method? surotkin Excel Programming 3 October 26th 05 04:32 PM


All times are GMT +1. The time now is 10:25 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"