tektripper
MIS
I am using excel 5 and am trying to use VBA to name a sheet after a range name or cell value. I keep getting the "Runtime error '13' Type mismatch error.
for example here is some of my code
RangeName = ActiveCell.value 'say is equal to Jan'
myRange.Name = RangeName
in the immediate window
?RangeName
Jan
?myRange.Name
=SheetName!$A$2:$K$67
shouldn't myRange.Name = RangeName = ActiveCell.value = Jan
although the immediate window shows this discrepency, the macro works OK, however if i try to assign the sheetname = range name i recieve the error. Can somebody provide me with some rules that need to be followed if i want to assign cell values or range names to variables which i then want to use as sheet names.
Hope i have made some sense. Please ask me to clarify if you might be able to help.
Thanks
for example here is some of my code
RangeName = ActiveCell.value 'say is equal to Jan'
myRange.Name = RangeName
in the immediate window
?RangeName
Jan
?myRange.Name
=SheetName!$A$2:$K$67
shouldn't myRange.Name = RangeName = ActiveCell.value = Jan
although the immediate window shows this discrepency, the macro works OK, however if i try to assign the sheetname = range name i recieve the error. Can somebody provide me with some rules that need to be followed if i want to assign cell values or range names to variables which i then want to use as sheet names.
Hope i have made some sense. Please ask me to clarify if you might be able to help.
Thanks