Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

Please help me with the macro for MS Excel

I have an excel book with several sheets, let say 3
i need help with macro to make sure when i run it
all cursors jump to A1 cell and stay there
0
rfedorov
Asked:
rfedorov
3 Solutions
 
jppintoCommented:
Sub position_cursor()
Dim i As Integer
 For i = 1 To ActiveWorkbook.Sheets.Count
    ActiveWorkbook.Sheets(i).Cells(1, 1).Select
 Next i
End Sub
0
 
jorgeandresserranoCommented:
Hi there! I hope this works for you:

Sub MyFunction()

    Dim ws As Worksheet
    Dim name As String
   
    name = ActiveSheet.name
   
    'To prevent the ugly blinking
    Application.ScreenUpdating = False
   
    For Each ws In Worksheets
        ws.Activate
        ws.Range("A1").Select
    Next ws
   
    ThisWorkbook.Worksheets(name).Activate
   
    Application.ScreenUpdating = True

End Sub
0
 
ragnarok89Commented:
Sub a1()
  For each sh in Thisworkbook.Sheets
  sh.Range("A1").select
  Next sh
end sub
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now