NeverHappyMike
Member
Hi
I'm updating multiple sheets that contain the same structure - 4 tables, one below the other, numbered rows from 50-250 and 7 columns. Above each table is a slightly different title, but each table has the same column headings. (see attached file)
I had recorded myself using the find and replace function and had started to try to integrate that into a working macro. But it seemed too specific.
I thought I might try looking at how I can use the fixed structure of these sheets to my advantage - and as a learning tool.
I have used a previous macro example (thanks NARAYANK991) to find the first number 50, however I'm not sure how you work back from there to select the cell 2 rows above it, paste in a value from an array, and then iterate through finding the remaining 3 other 50 values pasting in the next value from my array.
Mycode something below is pure make-believe, and copied from other macros. But I hope it gives you an idea of what I'm thinking of doing. I hope that looking at the issue this way would allow me to use what I learn on other problems I will face in the future.
Any help or advice you can give would be really appreciated.
Thanks
Mike.
I'm updating multiple sheets that contain the same structure - 4 tables, one below the other, numbered rows from 50-250 and 7 columns. Above each table is a slightly different title, but each table has the same column headings. (see attached file)
I had recorded myself using the find and replace function and had started to try to integrate that into a working macro. But it seemed too specific.
I thought I might try looking at how I can use the fixed structure of these sheets to my advantage - and as a learning tool.
I have used a previous macro example (thanks NARAYANK991) to find the first number 50, however I'm not sure how you work back from there to select the cell 2 rows above it, paste in a value from an array, and then iterate through finding the remaining 3 other 50 values pasting in the next value from my array.
My
Any help or advice you can give would be really appreciated.
Thanks
Mike.
Code:
Sub Find50()
Dim FoundCell2 As Range
Dim strNewValues as String
Dim strSearchForFifity as String
strSearchForFifity = Array("50", "50", "50", "50")
For I = 0 To UBound(strNewValues)
For I = 0 To 4
strNewValues = Array("Value 1", "Value 2", "Value 3", "Value 4")
For I = 0 To UBound(strNewValues)
For I = 0 To 4
With ActiveSheet
Set FoundCell2 = .Range("$A:$A").Find(strSeachForFifity(I), Range("A1"), xlValues, , xlByRows)
FoundCell2.Select
FoundCell2.Range(FoundCell-2Rows).
ActiveCell.FormulaR1C1 = strnewValue (I)
Next FoundCell2
End With
End Sub