×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

yes.

Public Function AddSheetWithNameCheckIfExists(i As Integer) As Worksheet
Dim ws As Worksheet
Dim newSheetName As String
newSheetName = "result" & i ' Substitute your range here
For Each ws In Worksheets
If ws.Name = newSheetName Or newSheetName = "" Or IsNumeric(newSheetName) Then
MsgBox "Sheet already exists or name is invalid", vbInformation
Exit Function
End If
Next
Sheets.Add Type:="Worksheet"
With ActiveSheet
.Move after:=Worksheets(Worksheets.Count)
.Name = newSheetName
End With
Set AddSheetWithNameCheckIfExists = ActiveSheet
End Function
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 睡觉前,最后一个问题,EXCEL的记录数,能不能突破65535(记不清了,反正是标准整数的大小)条ROW?
    • 不能呢?
      • You are kidding
    • No.
      • 你厉害,什么时候的问题了,不过谢谢了,我也弄不出来,所以想问问有没有人弄出来过
        • 不能超过。你用vba生成新的一页好了
          • 加个SHEET?
            • yes.
              Public Function AddSheetWithNameCheckIfExists(i As Integer) As Worksheet
              Dim ws As Worksheet
              Dim newSheetName As String
              newSheetName = "result" & i ' Substitute your range here
              For Each ws In Worksheets
              If ws.Name = newSheetName Or newSheetName = "" Or IsNumeric(newSheetName) Then
              MsgBox "Sheet already exists or name is invalid", vbInformation
              Exit Function
              End If
              Next
              Sheets.Add Type:="Worksheet"
              With ActiveSheet
              .Move after:=Worksheets(Worksheets.Count)
              .Name = newSheetName
              End With
              Set AddSheetWithNameCheckIfExists = ActiveSheet
              End Function
              • 谢谢,其实我也无聊,我只是在从别的数据库倒出的数据放到EXCEL里面美化一下,谁知道它才支持60000多。:)