我是VBA中的begginer,正在寻找解决方案来检查表中的某些内容。我想创建一个函数,告诉某个列(范围)中的单元格是否只有当标题列(范围)中的单元格等于某个时才是空的。我尝试了isempty和vlookup的组合,但没有奏效。 我希望描述清楚,无论如何,我附上了一个简单的问题表。先谢谢你! enter image description here表中的交叉引用
Q
表中的交叉引用
1
A
回答
0
不知道我明白你的问题100%,但允许首先我想我的理解,并与下面开始:
Sub isitEmpty()
With Sheets("Sheet1")
If IsEmpty(.Range("B1:E2")).Value Then
'do something
Else
'do something
End If
End With
End Sub
你要什么做的,如果该细胞是/不是空?
0
下面的代码可与以下假设:
Project Type
列在Column A
从Cell A4
A,B,C,D
类别开始会有所不同,但总会有标题中Row 3
您要参与
Project Type
如Y
所示,列在最后一列后面的列中,标题为A,B,C,D
。因此,它Column F
Sub Demo() Dim ws As Worksheet Dim lRProject As Long, lRMatch As Long, lastColumn As Long, i As Long Dim rngProject As Range, celPro As Range, rngMatch As Range, celMatch As Range Set ws = ThisWorkbook.Sheets("Sheet5") 'change to your sheet With ws lastColumn = .Cells(3, Columns.count).End(xlToLeft).Column 'gives last column with A,B,C,D lRProject = .Cells(.Rows.count, "A").End(xlUp).Row 'last row in Column A lRMatch = .Cells(.Rows.count, lastColumn + 1).End(xlUp).Row 'last row in Column F Set rngMatch = .Range(.Cells(1, lastColumn + 1), .Cells(lRMatch, lastColumn + 1)) Set rngProject = .Range("A4:A" & lRProject) For Each celMatch In rngMatch For Each celPro In rngProject For i = 2 To lastColumn If celPro.Value = celMatch Then If .Cells(celPro.Row, i) = "X" Then .Cells(celMatch.Row, i) = "Y" End If End If Next i Next celPro Next celMatch End With End Sub
参考文献见图像按你的形象。
相关问题
- 1. 交叉引用表
- 2. 交叉表引用
- 3. 来自交叉引用表
- 4. SQL交叉引用表
- 5. 交叉引用多个表
- 6. SQL交叉表引用
- 7. 在AddImage函数中找不到交叉引用表或交叉引用流
- 8. 在mySQL查询中交叉引用表?
- 9. github中的交叉引用提交
- 10. XSL交叉引用
- 11. XSL交叉引用
- 12. XTEXT交叉引用
- 13. XML交叉引用
- 14. 表之间的外键交叉引用
- 15. 交叉引用跨表的记录
- 16. 交叉索引引用
- 17. '交叉引用'DataTable的
- 18. 交叉引用的艺品
- 19. Django的:交叉引用
- 20. SQL交叉引用表自我参照
- 21. 比较两个交叉引用列表
- 22. 休眠(映射到交叉引用表)
- 23. 如何更新交叉引用表?
- 24. 合并两个交叉引用表?
- 25. c#克隆交叉引用列表
- 26. 如何查询SQL交叉引用表
- 27. 交叉引用Excel工作表
- 28. linq子查询表交叉引用
- 29. 更新Microsoft word中的交叉引用
- 30. Xtext中的交叉引用问题
哪里是附件? – user1
所以你想检查范围“B1:E2”是否为空,如果是,你想做什么? – user1