我遇到了很多问题。
我要做的是基本上让Excel解析范围单元格的内容,如果内容不等于“OWNED”,则将其复制到另一列。我实际上不知道该怎么做,一直在试验我在互联网上找到的不同的宏,但它们似乎都不适用于我需要的东西,而且我缺乏完成这项工作的知识,所以如果有人借给我一个人,我会很感激或至少指出我正确的方向。
所以基本上我是想从这个
获得到这个
正如您所看到的,我需要程序不在第一列上备用空单元格。
我将非常感谢有能力帮助我的人,这让我疯狂了几周:/
提前致谢。
编辑:添加代码
Sub Update()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ActiveWorkbook
Set ws = wb.Sheets("Hoja1")
Dim UninstalledColumn As String
Dim UninstalledRow As Integer
UninstalledColumn = "A"
UninstalledRow = 3
Dim UninstalledCell As Range
Set UninstalledCell = UninstalledColumn & Str(UninstalledRow)
Dim WorkstationList As Range
Set WorkstationList = Range("C3:C12")
End Sub
答案 0 :(得分:2)
试试这个
Sub Update()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ActiveWorkbook
Set ws = wb.Sheets("Hoja1")
Dim UninstalledColumn As String
Dim UninstalledRow As Integer
UninstalledColumn = "A"
UninstalledRow = 3
'this is how you would assign a range, but you don't need that.
' Dim UninstalledCell As Range
' Set UninstalledCell = ws.Range(UninstalledColumn & UninstalledRow)
Dim WorkstationList As Range
Set WorkstationList = ws.Range("C3:C12")
For Each cel In WorkstationList
If cel.Value <> "owned" Then
ws.Cells(UninstalledRow, UninstalledColumn) = cel.Value
UninstalledRow = UninstalledRow + 1
End If
Next cel
End Sub