如果满足特定条件,我正在拼命地寻求我的 excel 宏的帮助以隐藏行。我试图输入以前在其他问题答案中提供的所有代码,但无法运行该死的东西。
我的代码在没有行隐藏部分的情况下运行得非常好
在生成模板之前我需要以下计算
If range F30 to J30 is blank then rows 29 to 30 must be hidden
If range F33 to J33 is blank then rows 32 to 33 must be hidden
If range F30 to J33 is blank then rows 28 to 35 must be hidden
你能帮帮我吗
Function RangeName(sName As String) As String
RangeName = Application.Substitute(sName, " ", "_")
End Function
Sub MergePrint()
Dim wsForm As Worksheet, wsData As Worksheet
Dim sRngName As String, r As Long, c As Integer
Set wsForm = Worksheets("Template")
Set wsData = Worksheets("DataSource")
With wsData.Cells(1, 1).CurrentRegion
For r = 2 To .Rows.Count
If Not wsData.Cells(r, 1).EntireRow.Hidden Then
For c = 1 To .Columns.Count
sRngName = wsData.Cells(1, c).Value
Range(RangeName(sRngName)).Value = wsData.Cells(r, c)
Next
wsForm.PrintOut
End If
Next
End With
End Sub