选择所有“可见"的工作表(打印为pdf) [英] Select all "visible" worksheets (to print to pdf)
本文介绍了选择所有“可见"的工作表(打印为pdf)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在现有应用中使用以下内容,因此可以正常工作,因为可以将特定的工作表打印为pdf:
I'm using the following in an existing app and this works fine as is to print particular worksheets to a pdf:
Sheets(Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")).Select
我正在尝试仅打印我的可见" 工作表的数组.
I'm trying to print an array of just my "visible" worksheets.
我一直在寻找解决方案,但无法付诸实践.
I've searched for a solution but can't put my finger on it.
推荐答案
尝试以下代码,它应该可以满足您的需求.
Try this code, it should do what you are looking for.
Sub SelectSheets()
Dim myArray() As Variant
Dim i As Integer
Dim j As Integer
j = 0
For i = 1 To Sheets.Count
If Sheets(i).Visible = True Then
ReDim Preserve myArray(j)
myArray(j) = i
j = j + 1
End If
Next i
Sheets(myArray).Select
End Sub
这篇关于选择所有“可见"的工作表(打印为pdf)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文