Which is better line in code for Module

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
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

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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,224,814
Messages
6,181,120
Members
453,021
Latest member
Justyna P

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