View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Dr Dan[_2_] Dr Dan[_2_] is offline
external usenet poster
 
Posts: 19
Default If sheet name contains 'A' run macro1, if 'B' run macro 2?

Hi Mike,

Thanks for the code. Can't get it to run though. Here's what I was using...

Sub plotallsheets2()
'
' Macro14 Macro
' Macro recorded 23/02/2007 by Dan
'
' Keyboard Shortcut: Ctrl+m
'

Dim sht As Worksheet
For Each sht In Sheets
Name = sht.Name
Length = Len(Name)
If Mid(Name, Length - 4, 1) = "a" Then
plotchronoamperometry
ElseIf Mid(Name, Length - 4, 1) = "b" Then
plotIVcurve
ElseIf Mid(Name, Length - 4, 1) = "c" Then
plotchronoamperometry
End If

Next sht
End Sub