Query Related to Hiding sheet and change currency with the help of VBA code.

Iron Contributor

Hello Everyone, 

 

I have a 2 questions :

 

1st question --- What VBA code should i write to change Euro to USD currency?

 

2nd question --- Whenever i hide the sheet like - 

 

Annotation 2022-07-12 162422.png

 

 

then it run the code, then it shows error

like - 

Annotation 2022-07-12 162619.pngAnnotation 2022-07-12 162635.png

 

So, what should i write to show data which are visible sheet in YEARLY REPORT sheet??

 

Please help..

 

Here is a attached file..

3 Replies
The FOR EACH assigns a Worksheet object to ws, so you should be able to simply write ws.Select, I think.
From where should i write ?
Please help..

@Excel 

Sub LoopYearlyReport()
    Dim ws As Worksheet
    Dim FirstTime As Boolean
    FirstTime = True
    For Each ws In Worksheets
        If ws.Visible = xlSheetVisible And ws.Name <> "YEARLY REPORT" Then
            ws.Select
            If Range("A1").Value <> "Division" Then
                InsertHeaders
                FormatHeaders
            End If
            AutomateTotalSUM
            ' SELECT CURRENT DATA
            Range("A2").Select
            Range(Selection, Selection.End(xlDown)).Select
            Range(Selection, Selection.End(xlToRight)).Select
            ' COPY DATA
            Selection.Copy
            ' SELECT "YEARY REPORT"
            Worksheets("YEARLY REPORT").Select
            ' PASTE DATA
            Range("A30000").End(xlUp).Select
            If FirstTime <> True Then
                ActiveCell.Offset(1, 0).Select
            Else
                FirstTime = False
            End If
            ActiveSheet.Paste
        End If
    ' MOVE TO THE THE NEXT SHEET IN THE LOOP
    Next ws
    Worksheets("Yearly Report").Select
    If Range("A1").Value <> "Division" Then
        InsertHeaders
        FormatHeaders
    End If
    AutomateTotalSUM
    Application.CutCopyMode = False
End Sub