Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    Interesting project and you've written a decent software specification but it still a software specification and SO is not a free code writing service. Get started with the macro recorder and come back to edit your question to include your own effort when you run into trouble reforming the recorded code for the larger purpose. Commented Nov 17, 2015 at 10:50
  • Thank you for reading, i am not requesting code nor review of code. I'm asking wether my logic has flaws and if i have forgotten an important step that would kill functionality once written. I am currently reading and learning to write the above. Commented Nov 17, 2015 at 11:03
  • Your logic will work but it can be optimized. A 2-dimension variant array would be faster and the rows could be deleted in one piece instead of many small pieces. Once thing that stands out is you reliance on the length. Are 00900, etc formatted as Text or is that cell number formatting of 00000 to achieve the leading zeroes? When you walk through the rows, start at the bottom and work to the top. Commented Nov 17, 2015 at 11:10
  • They are indeed formatted as text. Think you found an interesting flaw in my logic there. As soon as i do a trim it isn't considered text anymore. I need to keep the leading 0. I use Dim Cell As Range For Each Cell In ActiveSheet.UsedRange.Columns("A").Cells x = x + 1 Cell.Value = WorksheetFunction.Trim(Cell.Value) Next Cancel the above, force putting it to text again before trimming does the trick. Commented Nov 17, 2015 at 11:30
  • There is a Range.Text property, a Range.Value property and a Range.Value2 property. The .Text is the displayed text so it could be either a text string of 5 characters or it could be a number formatted as 00000. Commented Nov 17, 2015 at 11:48