concatenate two cell to name new active sheet.

Status
Not open for further replies.

Hardhat

New Member
Joined
Jul 28, 2017
Messages
23
I am trying to pull data from to cells in a worksheet to name the tab of a new work sheet. I can make it work for data in one cell but not the two. Here is what i am using for the one

ActiveSheet.Name = Sheets(2).Range("A3").Offset(counter - 1, 0).Value 'name sheet

I would also like to have the Data from cell K3 as pat of the new work sheet name.

Chuck T
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
try this

ActiveSheet.Name = Sheets(2).Range("A3").Offset(counter - 1, 0).Value & Sheets(2).Range("K3").Value
 
Upvote 0
It did not work I even add the off set to the K3 value and it also faulted

ActiveSheet.Name = Sheets(2).Range("A3").Value & Sheets(2).Range("K3").Value.Offset(counter - 1, 0)
 
Last edited:
Upvote 0
hmm interesting... just tested it ... and it works fine....

Make sure in sheet2 there is actually a value in A3 plus the offset you are setting meaning is your counter is 50 make sure there is something in cell A52 of sheet 2 also in cell K3 of sheet2

if the error you get is a Run Time 1004 error then it means one of those or both is blank
 
Upvote 0
Sorry it had taken me so long to get back on this. I was pulled away on some other projects. I made sure that I had not blank space from 1 to 52 in A and K rows. But I am still getting a runtim erroe 1004. below is what i have in the editor. the line above your code works fine for just the one cell to name the work sheet, but I would like both colum a and k as the name of the work sheet.

For counter = 1 To 3 ''Sheets(1).Range("f5").Value 'one loop per employee


Sheets(1).Copy After:=Sheets(2) 'copy the sheet


'ActiveSheet.Name = Sheets(2).Range("A3").Offset(counter - 1, 0).Value 'name sheet


ActiveSheet.Name = Sheets(2).Range("A3").Offset(counter - 1, 0).Value & Sheets(2).Range("K3").Value
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,832
Messages
6,121,845
Members
449,051
Latest member
excelquestion515

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