hi all,
I have a simple range copying to fill a column. Idea is to split 408 contracts with yearly amounts into month s. Code is below- value 1 & value 2 reference cells in my excel , which are used to work out how many rows need to be copied/filled..for some reason, my code does nto work. Is there any chance you can help me to get the Loop to stop when value1 = value 2 ? Many manty thanks ! (value 3 is not used yet, so you can ignore it..)
I have a simple range copying to fill a column. Idea is to split 408 contracts with yearly amounts into month s. Code is below- value 1 & value 2 reference cells in my excel , which are used to work out how many rows need to be copied/filled..for some reason, my code does nto work. Is there any chance you can help me to get the Loop to stop when value1 = value 2 ? Many manty thanks ! (value 3 is not used yet, so you can ignore it..)
Code:
Sub Get_value()
Dim value1 As Long
Dim value2 As Long
Dim value3 As Long
value1 = ThisWorkbook.Sheets(2).Range("L1").Value 'value from sheet1
value2 = ThisWorkbook.Sheets(2).Range("O1").Value 'value from sheet2
value3 = ThisWorkbook.Sheets(2).Range("d1").Value 'value from sheet2
Do Until value1 = value2
Sheets("REPORT").Select
Range("A10").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DATA").Select
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.End(xlDown).Select
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
Loop
Do Until value1 = value2
End Sub
Last edited by a moderator: