Hi everyone, Am having a litter trouble with Macro in excel. here is my code.
Sub sampleworksheet()</SPAN>
Dim cursheet As Worksheet</SPAN>
Dim j As Integer</SPAN>
Dim curname As String</SPAN>
Dim channame As String</SPAN>
Dim modifiedchanname As String</SPAN>
'itterate all worksheets in workbook</SPAN>
For j = 1 To ActiveWorkbook.Worksheets.Count</SPAN>
cursheet = ActiveWorkbook.Worksheets(j)</SPAN>
If Not IsEmpty(curname.Cells(1, 1)) Then</SPAN>
channame = cursheet.Cells(4, 2)</SPAN>
curname = cursheet.Name</SPAN>
modifiedchanname = channame</SPAN>
'channame must be valid excel worksheet name!!!!!!!!!!!!</SPAN>
cursheet.Name = modifiedchanname</SPAN>
End If</SPAN>
Next j</SPAN>
End Sub</SPAN>
I am getting "invalid qualifer" at curname (i have highlighted it in the code). I cant seem to get my head around.
Can anyone help please, i will be soo happy
Sub sampleworksheet()</SPAN>
Dim cursheet As Worksheet</SPAN>
Dim j As Integer</SPAN>
Dim curname As String</SPAN>
Dim channame As String</SPAN>
Dim modifiedchanname As String</SPAN>
'itterate all worksheets in workbook</SPAN>
For j = 1 To ActiveWorkbook.Worksheets.Count</SPAN>
cursheet = ActiveWorkbook.Worksheets(j)</SPAN>
If Not IsEmpty(curname.Cells(1, 1)) Then</SPAN>
channame = cursheet.Cells(4, 2)</SPAN>
curname = cursheet.Name</SPAN>
modifiedchanname = channame</SPAN>
'channame must be valid excel worksheet name!!!!!!!!!!!!</SPAN>
cursheet.Name = modifiedchanname</SPAN>
End If</SPAN>
Next j</SPAN>
End Sub</SPAN>
I am getting "invalid qualifer" at curname (i have highlighted it in the code). I cant seem to get my head around.
Can anyone help please, i will be soo happy