Most valuable professional
  • Hot Topics

Excel Error 91: with block and setting worksheet name

Hi forum, I am having a weird problem that I've been struggling for a couple of weeks now. I have a list of employee names in Column A and a a For loop that sets the worksheet name ("wsName") to each cell value (employee names). The macro works fine for the first 13 employees; on the 14th employee, I get Error 91. For whatever reason, on employee 14, it is not setting "wsName". The 14th employee name doesnt have any symbols or numbers. Code: Dim Dim Set With wsSummary For i = 1 to 25 sName = .Range("A" & i).Value Set wsName = ThisWorkbook.Worksheets(sName) With wsName 'Some copy and End With Next i End With End Sub Thanks in advance for your help! Last edited by r3dal3rt; Yesterday at 11:11 AM.

This question generated 15 answers. To proceed to the answers, click here.

This thread is current as of January 29, 2018.

For more resources for Microsoft Excel:

This article includes the following tags:

  • Excel
  • Microsoft Excel