Which is better line in code for Module

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,213
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
In Module of my Workbook (coded.xlsm) and for the Worksheet (tab named “ZZZ”) I am using User Defined Function to get outputs in some cells where UDFs are there.

1 line of the code is

Rich (BB code):
If Sheets("ZZZ").Range("WA10").Value = "=1" Then
GoTo finish
End If

Should I replace the above lines with?

Rich (BB code):
If Application.Workbooks(“coded.xlsm”).Worksheets(“ZZZ").Cells(10, 599).Value = "=1" Then
GoTo finish
End If

Motto is
  1. speed of execution of the code & of course
  2. I don’t know whether the 2nd line/(s) would perform correctly or not?
Can some gurus of this forum help?
Thanks in advance
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I would use
VBA Code:
If ThisWorbook.Sheets("ZZZ").Range("WA10").Value = "=1" Then
but that's just personal preference.
 
Upvote 0
Solution
I would use
VBA Code:
If ThisWorbook.Sheets("ZZZ").Range("WA10").Value = "=1" Then
but that's just personal preference.
I'll try your above line tomorrow in the Module of my Workbook with real time data feeds in 1 Worksheet & then come back with the outcome.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,174
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top