I am trying to check values in column A on sheet A if it is a yes then values in column B and C need to be copied to column A and B in sheet B. This needs to be looped until it has checked all of the values and checked all of the rows. The code executes but it only copies the values onto the same sheet and only does it for the first line of values. I have tried selecting and activating but to no avail. Code is below:
Dim Count As Integer 'Count from workbook open
Dim CountVal As Integer
Dim Check As String 'check value for yes or no
Dim ufCheckvalue As Integer 'Gets go/nogo from userform
Dim Row1 As Integer 'row number for add/remove sheet
Dim Row2 As Integer 'row number for summary sheet
Dim SecNum As Integer 'value for section number
Dim Descrip As String 'value for description
ListCount = Range("B" & Rows.Count).End(xlUp).Row
Count = ListCount 'initalize values
CountVal = 0
Check = ""
ufCheckvalue = 0
Row1 = 10 'first row of values on add/remove sheet
Row2 = 5 'first row of values on summary sheet
SecNum = 0
Descrip = ""
ufContinue.Show 'user has to confirm it wants to run program
If ufCheckvalue = 1 Then
Unload ufContinue
Do
Check = Range(Cells(1, Row1)).Value 'gets the check value
If Check = "Yes" Then 'checks to see if yes
SecNum = Range(Cells(2, Row1)).Value 'sets values if yes
Descrip = Range(Cells(3, Row1)).Value
Sheets("Summary of Estimate").Select 'selects estimate page
Selection.Activate 'activates estimate page
Range(Cells(1, Row2)).Select 'selects cell to insert value into
Selection.Value = SecNum 'inserts value
Range(Cells(2, Row2)).Select 'selects cell to insert value into
Selection.Value = Descrip 'inserts value
Sheets("Add-Remove").Select 'goes back to original worksheet
Row2 = Row2 + 1 'adds one to row2 so it will index to next line
End If
Row1 = Row1 + 1 'changes rows for check value
CountVal = CountVal + 1 'adds one to count value
Loop Until CountVal = Count 'loops until it has looped countval number of times
ElseIf ufCheck = 0 Then 'makes the update button visible
Unload ufContinue
cmdUpdate.Visible = True 'Shows the update button
End If
I do apologize if that does not really make sense. I learned enough to be dangerous in college.