Hi All,
Someone on this forum has kindly help me with a find command for some data that is variable.
The problem I have now is if the code doesn't match a string it then errors. What I need is when the string is not found to display a Msgbox with an error then back to the user form.
I've tried many ways but I can't it too work.
Below is the code I'm using which is searching for the string "Cell Voltage 01" in row 1 of an activesheet. so if "Cell Voltage 01" is not found display msgbox. If the data is found it copy and paste to a new sheet and it is then turned into a chart.
Sounds simple and probably is, but I just can't work it out.
Cheers
Someone on this forum has kindly help me with a find command for some data that is variable.
The problem I have now is if the code doesn't match a string it then errors. What I need is when the string is not found to display a Msgbox with an error then back to the user form.
I've tried many ways but I can't it too work.
Below is the code I'm using which is searching for the string "Cell Voltage 01" in row 1 of an activesheet. so if "Cell Voltage 01" is not found display msgbox. If the data is found it copy and paste to a new sheet and it is then turned into a chart.
Sounds simple and probably is, but I just can't work it out.
Cheers
Code:
' Selectdata
'
Dim lr As Long
lr = Worksheets("Consult_Data").Cells.Find("*", , xlValues, , xlByRows, xlPrevious).Row
Worksheets("Consult_Data").Rows(1).Find("CELL VOLTAGE 01", lookat:=xlPart).Resize(lr, 96).Select
Selection.Copy
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
ActiveSheet.Name = "Data"