i have seen some strange code what is it for?

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Code:
On Error Resume Next
Set TBA = ActiveSheet.Shapes("TBA" & a)
Set TBB = ActiveSheet.Shapes("TBB" & a)
Set TBC = ActiveSheet.Shapes("TBC" & a)
Set TBD = ActiveSheet.Shapes("TBD" & a)
Set TBE = ActiveSheet.Shapes("TBE" & a)
Set TBF = ActiveSheet.Shapes("TBF" & a)
Set TBR = ActiveSheet.Shapes("TBR" & a)
Set TBL = ActiveSheet.Shapes("TBL" & a)
 
Upvote 0
Code:
a = (Target.Row - 11) / 3
The above appears to be part of worksheet event code and it is initializing the variable 'a' with a vaule derived from the row number where the event took place (cell value change or selction change) minus eleven and then that value divided by three.

The example in post #2 is using the Set method of initializing several object variables (looks like might be text boxes) as shapes. The 'On Error Resume Next' allows the code to continue if it cannot find one or more of the text boxes. There should be a subsequent line of
Code:
On Error GoTo 0
to clear any error that does occur.
 
Last edited:
Upvote 0
Why he took 11 and 3 ?
If I replace something with number in the place of 11 and 3, nothing will change in my sheet everything works fine in sheet
 
Last edited:
Upvote 0
Why he took 11 and 3 ?
If I replace something with number in the place of 11 and 3, nothing will change in my sheet everything works fine in sheet

The original question was what the code did. There is no way to determine why it was writen that way based on information provided in this thread. You would need to look at how the variable 'a' is used throughout the remainder of the code to understand the logic of why its value is calculated in the manner shown above.
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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