![]() |
Window Message to Verify Data Already typed
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 |
Window Message to Verify Data Already typed
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 |
All times are GMT +1. The time now is 08:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com