Need help updating sheets name to look into workbook VBA

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,129
Office Version
  1. 365
Platform
  1. Windows
Hi so I run this macro in my workbook now, but I need to change this now to look into a different workbook called "Time" sheet name --->Sheets("Name Correction"). I need to add to all of these below to look at this sheet name but in a different book called Time--> Sheets("Name Correction"). Any help thanks



Code:
Sub ChangeNamesForTimesheetAlphCorrection() 'Change names in Column to map names for timesheet New'
Application.ScreenUpdating = False
Dim i As Long
Dim b As Long
Dim c As Long
Dim Lastrow As Long
Dim LastRowA As Long
Windows("FIle Zed Upload For Time Macro 2.xlsm").Activate
Lastrow = Sheets("Data (2)").Cells(Rows.count, "B").End(xlUp).Row
LastRowB = Sheets("Name Correction").Cells(Rows.count, "A").End(xlUp).Row
    For i = 1 To Lastrow
        For b = 1 To LastRowB
            If Sheets("Data (2)").Cells(i, 2).Value = Sheets("Name Correction").Cells(b, 1).Value Then
                Sheets("Data (2)").Cells(i, 2).Value = Sheets("Name Correction").Cells(b, 2).Value
            End If
        Next
    Next
Application.ScreenUpdating = True
End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top