Forum Discussion

Excel's avatar
Excel
Iron Contributor
Jul 12, 2022

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

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 - 

 

 

 

then it run the code, then it shows error

like - 

 

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

  • ecovonrein's avatar
    ecovonrein
    Iron Contributor
    The FOR EACH assigns a Worksheet object to ws, so you should be able to simply write ws.Select, I think.
    • Excel's avatar
      Excel
      Iron Contributor
      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

Resources