Hi again
I have a loop that seems to stop working after two cells in a list than drops out of loop. I can not see why. It has a simple if statement in it. I just can not make it work.
I attached the workbook.
The code is in module 3
Loop works through list on sheet3 in col (D) , but when PM is selected on the interface sheet, and sheet3.range("A3") is false the loop it is to work down col (E).
This is my first loop and I almost have it. The loop finds cell on DBtable that I am going to paste data into.
myvalue3 is not used.
thanks for any help. and your time.
[vba]
Sub looptest()
Dim myvalue As Long
Dim myvalue2 As Long
Dim myvalue3 As Long
Sheet3.Activate
If Range("a3") = True Then
Range("d:d").Activate
Else
Range("e:e").Activate
End If
Do
myvalue = WorksheetFunction.Match(ActiveCell.Value, Sheet1.Range("headers"), 0)
myvalue2 = WorksheetFunction.Match(Sheet3.Range("a1"), Sheet1.Range("b:b"), 0)
'Do
'myvalue3=
Sheet3.Range("Ampcu").Copy
Sheet1.Activate
Sheet1.Cells(myvalue2, myvalue).Select 'Activate
'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
'Range(Cells(myvalue2, myvalue)).Value = Range("Ampcu").Value
MsgBox (myvalue)
Sheet3.Activate
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 1))
End Sub
[/vba]