Reduce redundancy

renrut_5

New Member
Joined
Sep 28, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I have the following simple program I am using to locate lockout points within this large building I am working in.

Private Sub but1afe_Click()
Dim i As Integer
For i = 2 To 1000

If Sheet5.Cells(i, 1).Value = txtAssetafe.Text Then
txtlocationafe.Text = Sheet5.Cells(i, 2).Value
txtP1afe.Text = Sheet5.Cells(i, 3).Value
txtE1afe.Text = Sheet5.Cells(i, 4).Value
txtE2afe.Text = Sheet5.Cells(i, 5).Value
txt6ft1afe.Text = Sheet5.Cells(i, 7).Value
txt6e1afe.Text = Sheet5.Cells(i, 8).Value
txt6ft2afe.Text = Sheet5.Cells(i, 9).Value
txt6e2afe.Text = Sheet5.Cells(i, 10).Value


Exit For
End If

Next i

No stretch just simply programming. However, in my excel sheet I have a host of lockout points that are within six feet of one another and policy states that you must lockout any equipment within 6 feet so my spreadsheet looks like this.


txtassettxtlocationtxtP1txtE1txtE2Within 6txt6ft1txt6e1txt6p1txt6ft2txt6e2txt6p2
45180​
Lane 1 101/102P-144E-3836
45185​
E-3835
44748​
E-3089
45185​
Lane 1 101/102E-3835
45180​
E-3836P-144
45190​
E-3834
45190​
Lane 1 101/102E-3834
45185​
E-3835
45195​
E-3833
45195​
Lane 1 101/102E-3833
45190​
E-3834
45005​
45275​
Lane 2 103/104E-3838
45280​
E3840P-145
44720​
E-????
45280​
Lane 2 103/104P-145E-3840
45275​
E-3838
45285​
E-3843
45285​
Lane 2 103/104E-3843
45280​
E-3840P-145
45290​
E-3845
45290​
Lane 2 103/104E-3845
45285​
E-3843
45295​
E-3880
45295​
Lane 2 103/104E-3880
45290​
E-3880
45005​
45375​
Lane 3 105/106E-3839
43920​
E-3093
45380​
E-3841P-146
Is there anyway I can reduce the redundancy within the spreadsheet and still have it work correctly. Please note that I am trying my best to keep this simple as I will be leaving this building soon and the one that is taking my place on this project is just now learning the VBA side of excel.

Thanks
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Reminder: Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Reduce redundancy
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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