1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How to look through sheets in Excel

Discussion in 'Business Applications' started by tumblez, Nov 30, 2010.

Thread Status:
Not open for further replies.
  1. tumblez

    tumblez Thread Starter

    Nov 30, 2010
    I've got a macro, that I want to modify so that it reads the one worksheet, then makes global changes to all the other worksheets. I only know how to get it to update the single sheet specified sheets(2), but don't know how to get it to do updates to all the sheets.
    Sub test()
    Dim lrow As Long, i As Long
    With Sheets(1): .Activate: Application.ScreenUpdating = False
    lrow = Cells(Rows.Count, 1).End(xlUp).Row
    For i = lrow To 2 Step -1
        If Cells(i, 1) <> "" Then
        Sheets(2).[b:z].Replace What:=.Cells(i, 1), Replacement:=.Cells(i, 2), LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=True: With Cells(i, 1): .Value = Cells(i, 2)
        .Interior.ColorIndex = 35: End With: End If
    Next: End With: End Sub
  2. Keebellah

    Keebellah Trusted Advisor

    Mar 27, 2008
    First Name:
    Hi welcome to the board:
    you can loop through all the sheets
    Dim ws as worksheet
    For Each wS In ActiveWorkbook.Worksheets
     < your code here>
    next ws
    You will probably have to include a check to see if its the sheet you nedd but since you can code some thing I imagine you'll be able to work with the code above?
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/965621

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice