Link a sheet name to a cell

jo_jan

New Member
Joined
Feb 12, 2019
Messages
5
I have an error in my code but I don't know where... The thing is that I never know which name will be in the cells and I want it to be linked to the name of the sheet. I always have an error on line 6 but I don't know why. This is a part of my code:

For x = 0 To 10
Sheets("DataEntry").Select
nomfeuille = Cells(1, 3 + x).Value
Sheets("DataEntry").Select
date1 = Cells(2, 3 + x).Value
Sheets(nomfeuille).Select
col_date = Range("A1").End(xlToRight).Column + 1
Cells(1, col_date).Value = date1
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Apparently Cells(1,3+x) does not contain the correct+existing sheet name - please check this.
If the name appears right and still error occurs pl check if the value in the cell has additional invisible characters like space or other non-printable characters.
Hope this helps.
 
Upvote 0
check that nomfeuille is the correct sheet name. Also what error are you getting?
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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