View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Advice on multiple macros, same code just a different column

Hi Howard,

Am Fri, 14 Feb 2014 18:37:14 +0100 schrieb Claus Busch:

try:

Sub Test()


or without Select case:

Sub Test2()
Dim rngC As Range, c As Range
Dim AppRng As Range, ComRng As Range
Dim Start As Long, i As Long
Dim MyCol As String

MyCol = Application.InputBox("Please enter a column character", _
"Column check", Type:=2)

If MyCol = "" Or MyCol = "False" Then Exit Sub

Start = Asc(MyCol) - 69 - (71 - Asc(MyCol)) * 6

With Sheets("Comments")
Set ComRng = .Range(.Cells(Start, 2), .Cells(Start + 6, 2))
End With

With Sheets("Application")
Set AppRng = .Range(.Cells(6, MyCol), _
.Cells(.Rows.Count, MyCol).End(xlUp))
End With

For Each rngC In AppRng
For Each c In ComRng
If c = rngC Then
rngC.ClearComments
rngC.AddComment c.Offset(, 1).Text
End If
Next
Next

End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2