Tab Names to Match Cell Values when Changed
opps, use this
Maybe something like:
Option Explicit
Sub testme()
Dim iRow as long
with activesheet
for irow = 2 to .cells(.rows.count,"A").end(xlup).row
sheets(irow).name = .cells(irow,"A").value
next irow
end with
End Sub
"Eduardo" wrote:
Hi,
try
Option Explicit
Sub testme()
Dim iRow as long
with activesheet
for irow = 1 to .cells(.rows.count,"A").end(xlup).row
sheets(irow).name = .cells(irow,"A").value
next irow
end with
End with
This could fail if you have invalid names in column A and/or there are
duplicate
names or sheets with the same name already existing. Or if you don't have
enough sheets!
"Johnny" wrote:
In cell A1 I have the year 2008.
In cells A2 through A4 I have a formula to add one year as I move down each
cell so that in A2 would be 2009, A3-2010 and so on. I also four worksheets
that are named for each of those years. I would like to have VBA code to
rename the TAB Names when I change cell A1 which will in turn change each for
the four TAB Names to match whats in cells A1 - A4 respectively.
Hope my question is clear enough for someone to help me come up with a
solution.
|