View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ronald Dodge[_2_] Ronald Dodge[_2_] is offline
external usenet poster
 
Posts: 130
Default Programming problem.

Dim lngRow as Long, bolEmpty as Boolean, I as Long, wshQUOTE as worksheet

'Note, change the book name and worksheet name below accordingly to your
file.
Set wshQUOTE = Workbooks("Book1.xls").Worksheets("Quote")
lngRow = 22
bolEmpty = False

Do While bolEmpty = False and lngRow < 65537
bolEmpty = True
For I = 1 to 3 Step 1
If VBA.IsEmpty(wshQUOTE.Cells(lngRow,I)) = False then
bolEmpty = False
lngRow = lngRow + 3
Exit For
End If
Next I
Loop

If bolEmpty = False Then
MsgBox "The worksheet is full in columns A - C.",48
Else
wshQUOTE.Cells(lngRow,1).Value2 = 1 'Make sure to have column A
formatted properly
wshQUOTE.Cells(lngRow,2).Value2 = "Non PDF File Download"
wshQUOTE.Cells(lngRow,3).Value2 = 15 'Make sure to have column C
formatted properly
End if

"JonathanW" wrote in message
...
I am building a quoting system and A22 has the qty B22 has the description
and C22 has the price. Sometimes B22 has two lines of information and when
I
use the code below, then the information that is meant to be inserted ends
up
on different lines.

How do I change my code so that it checks the row first to see if there is
anything on that line and if all fields are blank it will then go ahead
with
inserting the informaiton or if there is any info in any of the rows it
will
offset three rows.

Thanks for your help

Here is the current code:



Range("A22").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(3, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = "1"

Range("B22").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(3, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = "Non PDF File Download"

Range("C22").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(3, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = "$15"