Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro which calls lst files under specific directory (see macro
below). Most of the time, the data is not typed accordingly to call the lst files. I wonder if I can get a window message to tell me that "MAKE SURE DATA TYPED ON CELLS C3, C5 AND C6 MATCH WITH LAB DATA". Thanks in advance. Maperalia Sub List_lst_Files1() Const basicPath = "S:\GEOTEST\shears\" Const listSheetName = "List of lst Files" Dim anyFileName As String Dim searchFor As String Dim rOffset As Long Dim listBaseCell As Range Application.ScreenUpdating = False searchFor = basicPath & _ Worksheets("DEFAULTS").Range("C3").Value & "\" & _ Worksheets("DEFAULTS").Range("C5").Value & "*" & _ Worksheets("DEFAULTS").Range("C6").Value & "*.lst" anyFileName = Dir$(searchFor) Do While anyFileName < "" listBaseCell.Offset(rOffset, 0) = anyFileName rOffset = rOffset + 1 anyFileName = Dir$ ' gets next match for original 'mask' Loop Set listBaseCell = Nothing ' release resource Application.ScreenUpdating = False End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See changes below (marked with **)
-- JNW "maperalia" wrote: I have a macro which calls lst files under specific directory (see macro below). Most of the time, the data is not typed accordingly to call the lst files. I wonder if I can get a window message to tell me that "MAKE SURE DATA TYPED ON CELLS C3, C5 AND C6 MATCH WITH LAB DATA". Thanks in advance. Maperalia Sub List_lst_Files1() Const basicPath = "S:\GEOTEST\shears\" Const listSheetName = "List of lst Files" Dim anyFileName As String Dim searchFor As String Dim rOffset As Long Dim listBaseCell As Range Application.ScreenUpdating = False ** onerror goto ErrRoutine searchFor = basicPath & _ Worksheets("DEFAULTS").Range("C3").Value & "\" & _ Worksheets("DEFAULTS").Range("C5").Value & "*" & _ Worksheets("DEFAULTS").Range("C6").Value & "*.lst" anyFileName = Dir$(searchFor) Do While anyFileName < "" listBaseCell.Offset(rOffset, 0) = anyFileName rOffset = rOffset + 1 anyFileName = Dir$ ' gets next match for original 'mask' Loop Set listBaseCell = Nothing ' release resource ** Application.screenupdating = false ** Exit sub ** ErrRoutine: ** msgbox "MAKE SURE DATA TYPED ON CELLS C3, C5 AND C6 MATCH WITH LAB DATA" Application.ScreenUpdating = False End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
unusual window message | Excel Discussion (Misc queries) | |||
How can I check/verify data in my Data Source for Pivot table? | Excel Worksheet Functions | |||
when certain number is typed in a cell to display a message | Excel Discussion (Misc queries) | |||
Window Message for not value found | Excel Programming | |||
Adding message window | Excel Discussion (Misc queries) |