Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
referencing a file name and sheet name
how can i reference the file name so that whenever i run this macro in other
file i dont have to go to and change the Worrkbook name and worksheet name. i want it to recognize it itself because i am going to be usign the macro on multipe excel file. here is the code Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Dim rng As Range Dim rCell As Range Set WB = Workbooks("*.xls") Set SH = WB.Sheets("VT Masterlist") ' Set rng = SH.Range("A:A") For Each rCell In rng.Cells With rCell ipos = InStr(rCell.Value, ".") If ipos 0 Then rCell.Value = Left(rCell.Value, ipos - 1) End If End With Next rCell End Sub |