'Is there a way to use VBA to check the value a a certain cell on several different worksheets and display the highest value?
I am trying to loop through a bunch of sheets and check the same cell in each sheet and report back the highest value. I currently have some code that loops through a sheet and copies some data and paste in below and it cycles through all the sheets but I cannot figure out how to get the determine max value part. Data used to copy data from one sheet to another shown below.
Public Sub CopyData()
Dim i As Integer
For i = 2 To ThisWorkbook.Worksheets.Count
'Method 1
Sheets("4-1-21").Range("A53:F100").Copy Destination:=Sheets(i).Range("A53:F100")
'Method 2
'Copy the data
Sheets("4-1-21").Range("A53:F100").Copy
'Activate the destination worksheet
Sheets(i).Activate
'Select the target range
Range("A53:F100").Select
'Paste in the target destination
ActiveSheet.Paste
Application.CutCopyMode = True
Next i
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
