clean code

  1. L

    Help Cleaning Up Code

    Below is code that I have inherited. I am not a coder. It is extremely slow and clunky from what I can tell. The number of rows in the original text file can vary. Is there a way to clean this up? This is what the original text file looks like: Sub Macro1() Dim strFile As String Dim wb...
  2. D

    I want to speed(clean) up my code with loops

    I have 16 different blocks of code that have the same structure as below. Is there a way to speed this up and make it cleaner with loops? Thanks :) ActiveSheet.Range("D8") = reg1 ActiveSheet.Range("D9") = reg2 ActiveSheet.Range("D10") = reg3 ActiveSheet.Range("D11") = reg4...
  3. A

    Multiple criteria array

    Hi guys, very long time lurker but first-time poster. I am wondering if anyone could help me clean up this array formula. I need to be able to count all instances of 0,1,2 except for [0,0],[0,1],[1,0],[1,1]. Please forgive my quick and dirty formula (not safe for looking). It is working as...
  4. K

    Run Time Error '1004': Select Method of Worksheet class failed

    Hi, I'm having trouble with this error that appears whenever I try to run macros. Sub Filter() Sheets("Combination").Select Range("A4:AJ598").AutoFilter ActiveSheet.Range("$A$4:$AJ$598").AutoFilter Field:=1, Criteria1:="Y" ActiveSheet.AutoFilter.Range.Copy...
  5. G

    simplify code

    I have pieced together 2 pieces of code. One section runs a sort whilst the other un hides columns and applies a filter. What I would like to do is clean up the code but am unsure how to do it. In one instance it refers to the Active Workbook.Worksheets and in another instance it refers to the...
  6. L

    Please simply this macro - hide all sheets except specific set

    Hi, The following macro works, however I am trying to clean up the code Sub ShowSet1() Dim xWs As Worksheet Dim xName As String xName = "Sheet5" For Each xWs In Application.ActiveWorkbook.Worksheets If xWs.Name <> xName Then xWs.Visible = xlSheetHidden End If Sheets("Sheet1").Visible = True...
  7. A

    How do I condense this code that copies "HOURS" text to next available D field based on value

    Set sh = wb.Sheets("Hours") If sh.Range("c2") = "12" Then Set sh = wb.Sheets("Work") sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS" sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS" sh.Range("D" &...

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