Advertisement
YasserKhalil2019

T4250_Check If Worksheet Exists Using Evaluate ISREF

Nov 2nd, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. https://excel-egy.com/forum/t4250
  2. ---------------------------------
  3.  
  4. Sub Check_If_Worksheet_Exists_Using_Evaluate_ISREF()
  5. Dim x, ws As Worksheet, sh As Worksheet, s As String
  6.  
  7. Set ws = ThisWorkbook.Worksheets(1)
  8. s = "نوبة " & ws.Range("C2").Value
  9. If Evaluate("ISREF('" & s & "'!A1)") = False Then Exit Sub Else Set sh = ThisWorkbook.Worksheets(s)
  10.  
  11. x = Application.Match(ws.Range("B10").Value2, sh.Columns(2), 0)
  12. If Not IsError(x) Then sh.Range("C" & x).Resize(1, 4).Value = ws.Range("C10").Resize(1, 4).Value
  13. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement