Vba one part of my macro doesn't make any sense

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 10:02 PM GMT

QuestionEdit

I set count to equal the number of used rows (because I was checking for blanks for actually this specific accumulator, usedrange doesn't work. I also left out the part where the z is accumulated, because I felt it was irrelevant.)

For x= 3 to count If z <> 0 Then incompleteSchematicGeometric = incompleteSchematicGeometric + 1 With Worksheets("Schematic Geometric").Cells(x, 2).Font .Name = "Times New Roman" .Italic = True .Bold = True End With With Worksheets("Schematic Geometric").Cells(x, 6).Font .Name = "Times New Roman" .Italic = True .Bold = True End With End If z = 0 Next x

For some reason, the number of rows bolded and the integer incompleteSchematicGeometric are different. I can't understand it.

AnswerEdit

The only possible thought I have is that IncompleteSchematicGeometric was not set to zero before the loop started - otherwise as you say it doesn't make sense as this counter is incremented by one everytime the loop is executed - though as the code sample you have given me resets z but only runs if z isn't 0, then the accumulation part MAY be relevent!

If it helps, my email is aidan.heritage@virgin.net

Advertisement

©2024 eLuminary LLC. All rights reserved.