I want to create a macro to insert a value in cell "U37", but that value can only be inserted in spreadsheets with the name other than "Potável C1", "Potável C2", "Potável C3.1", and "Potável C3.2"
I know my code is not right but I currently have the following:
Someone can help me?
I know my code is not right but I currently have the following:
VBA Code:
Dim ws, counter As Integer
Dim sh As Worksheet
Public Sub WriteValues()
For Each sh In ThisWorkbook.Worksheets
If sh.Name <> "Potável C1" Or sh.Name <> "Potável C2" Or sh.Name <> "Potável C3.1" Or sh.Name <> "Potável C3.2" Then
ws = ActiveWorkbook.Sheets.Count
For counter = 1 To ws
Worksheets(counter).Select
Range("AC12").Select
If ActiveCell.Value = "" Then
With ActiveSheet.Range("AC12:AE12")
.Font.Bold = True
.Value = Array("Date", "Time", "Value")
.HorizontalAlignment = xlRight
End With
Else
End If
Range("AC13").Select
If ActiveCell.Value = "" Then
ActiveCell.Value = Range("U13").Value
Range("AE13").Value = WorksheetFunction.Sum(Range("W13:W108"))
Range("AF13").Value = "kWh"
Else
End If
Next counter
Else
End If
Next
End Sub
Someone can help me?