![]() |
help with a do while loop
Hi I was wondering if anyone could help me trouble shoot my code. I'm trying
to place specific text "LBC04" in blank cells using a Do While Loop to determine the appropiate cells. I've used the following code successfully numerous times, however, in this situation the "LBC04" is not being entered into the cells. The Loop looks like it's working correctly, however, the text just isn't being placed in the cells. Can anyone see a problem with my code? Public Sub TEST10() [M7].Select Do While ActiveCell.Offset(0, -1).Value "" If ActiveCell.Value = "" Then ActiveCell.Value = "LBC04" End If ActiveCell.Offset(1, 0).Select Loop End Sub -- Regards, timmulla |
help with a do while loop
Works fine for me.
What do you have in M7 and L7? -- HTH Bob Phillips "timmulla" wrote in message ... Hi I was wondering if anyone could help me trouble shoot my code. I'm trying to place specific text "LBC04" in blank cells using a Do While Loop to determine the appropiate cells. I've used the following code successfully numerous times, however, in this situation the "LBC04" is not being entered into the cells. The Loop looks like it's working correctly, however, the text just isn't being placed in the cells. Can anyone see a problem with my code? Public Sub TEST10() [M7].Select Do While ActiveCell.Offset(0, -1).Value "" If ActiveCell.Value = "" Then ActiveCell.Value = "LBC04" End If ActiveCell.Offset(1, 0).Select Loop End Sub -- Regards, timmulla |
help with a do while loop
Hi Tinmulla,
Check that the blank cells rally are blank. Your experience is consistent, for example with cells that appear blank but, in fact, contain a leading space. --- Regards, Norman "timmulla" wrote in message ... Hi I was wondering if anyone could help me trouble shoot my code. I'm trying to place specific text "LBC04" in blank cells using a Do While Loop to determine the appropiate cells. I've used the following code successfully numerous times, however, in this situation the "LBC04" is not being entered into the cells. The Loop looks like it's working correctly, however, the text just isn't being placed in the cells. Can anyone see a problem with my code? Public Sub TEST10() [M7].Select Do While ActiveCell.Offset(0, -1).Value "" If ActiveCell.Value = "" Then ActiveCell.Value = "LBC04" End If ActiveCell.Offset(1, 0).Select Loop End Sub -- Regards, timmulla |
help with a do while loop
Are the cells you are checking actually empty or is there one or more blanks
in the cells? Try this... Public Sub TEST10() [M7].Select Do While ActiveCell.Offset(0, -1).Value "" If trim(ActiveCell.Value) = "" Then ActiveCell.Value = "LBC04" End If ActiveCell.Offset(1, 0).Select Loop End Sub -- HTH... Jim Thomlinson "timmulla" wrote: Hi I was wondering if anyone could help me trouble shoot my code. I'm trying to place specific text "LBC04" in blank cells using a Do While Loop to determine the appropiate cells. I've used the following code successfully numerous times, however, in this situation the "LBC04" is not being entered into the cells. The Loop looks like it's working correctly, however, the text just isn't being placed in the cells. Can anyone see a problem with my code? Public Sub TEST10() [M7].Select Do While ActiveCell.Offset(0, -1).Value "" If ActiveCell.Value = "" Then ActiveCell.Value = "LBC04" End If ActiveCell.Offset(1, 0).Select Loop End Sub -- Regards, timmulla |
help with a do while loop
It worked. Thanks for your help!
-- Regards, timmulla "Jim Thomlinson" wrote: Are the cells you are checking actually empty or is there one or more blanks in the cells? Try this... Public Sub TEST10() [M7].Select Do While ActiveCell.Offset(0, -1).Value "" If trim(ActiveCell.Value) = "" Then ActiveCell.Value = "LBC04" End If ActiveCell.Offset(1, 0).Select Loop End Sub -- HTH... Jim Thomlinson "timmulla" wrote: Hi I was wondering if anyone could help me trouble shoot my code. I'm trying to place specific text "LBC04" in blank cells using a Do While Loop to determine the appropiate cells. I've used the following code successfully numerous times, however, in this situation the "LBC04" is not being entered into the cells. The Loop looks like it's working correctly, however, the text just isn't being placed in the cells. Can anyone see a problem with my code? Public Sub TEST10() [M7].Select Do While ActiveCell.Offset(0, -1).Value "" If ActiveCell.Value = "" Then ActiveCell.Value = "LBC04" End If ActiveCell.Offset(1, 0).Select Loop End Sub -- Regards, timmulla |
help with a do while loop
Sub fillempty_LBC04()
Selection.SpecialCells(xlCellTypeBlanks) = "LBC04" End Sub --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "timmulla" wrote in message ... Hi I was wondering if anyone could help me trouble shoot my code. I'm trying to place specific text "LBC04" in blank cells using a Do While Loop to determine the appropiate cells. I've used the following code successfully numerous times, however, in this situation the "LBC04" is not being entered into the cells. The Loop looks like it's working correctly, however, the text just isn't being placed in the cells. Can anyone see a problem with my code? Public Sub TEST10() [M7].Select Do While ActiveCell.Offset(0, -1).Value "" If ActiveCell.Value = "" Then ActiveCell.Value = "LBC04" End If ActiveCell.Offset(1, 0).Select Loop End Sub -- Regards, timmulla |
All times are GMT +1. The time now is 05:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com