Greetings all, I am updating an estimating spreadsheet that I wrote probably 15 to 20 years ago. I wrote a macro back then that transferred information from the cost part of the sheet to the estimate sheet below, but it was in the old XLA format and I can no longer save it or make changes to it, it still works but I cannot update it. I started playing around with the VBA to write this macro and everything works, but I am stuck on how to continue the loop to repeat the operation. I have been googling my asws off with no luck, so looking for help from people much smarter than I.
Here is a screen grab of my worksheet https://1drv.ms/u/s!ArDeb5a0pUjjgvcwHmb0JGMRt_9fbQ. When the cell in column a matches cell C4, i need to copy and paste data from several cells in the cost section at the top. The macro I wrote copies the information for the first cell it encounters, row 24, but it does not repeat the function in Row 32. Here is what I have written for my macro:
I assume I am missing something easy here or my syntax is wrong at the start, any help would be greatly appreciated.
Code:
Sub RectangleRoundedCorners1_Click()
Range("a1").Select
For i = 1 To 400 'select 400 cells
ActiveCell.Offset(1, 0).Select 'drop one row and select again
If ActiveCell.Value = Range("c4").Value Then
Range("o13").Copy
ActiveCell.Offset(0, 8).PasteSpecial xlPasteValuesAndNumberFormats
Range("o12").Copy
ActiveCell.Offset(0, 1).PasteSpecial xlPasteValuesAndNumberFormats
Range("m5").Copy
ActiveCell.Offset(0, 6).PasteSpecial xlPasteValuesAndNumberFormats
Range("m6").Copy
ActiveCell.Offset(0, 2).PasteSpecial xlPasteValuesAndNumberFormats
Range("m7").Copy
ActiveCell.Offset(0, 2).PasteSpecial xlPasteValuesAndNumberFormats
Range("m8").Copy
ActiveCell.Offset(0, 2).PasteSpecial xlPasteValuesAndNumberFormats
Range("m9").Copy
ActiveCell.Offset(0, 2).PasteSpecial xlPasteValuesAndNumberFormats
Range("o15").Copy
ActiveCell.Offset(0, 2).PasteSpecial xlPasteValuesAndNumberFormats
Range("o12").Copy
ActiveCell.Offset(0, 2).PasteSpecial xlPasteValuesAndNumberFormats
End If
Next i
Range("c5").Select 'return home
End Sub
I assume I am missing something easy here or my syntax is wrong at the start, any help would be greatly appreciated.
Last edited by a moderator: