Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel-VBA |解析范围值并复制到另一列_Vba_Excel - Fatal编程技术网

Excel-VBA |解析范围值并复制到另一列

Excel-VBA |解析范围值并复制到另一列,vba,excel,Vba,Excel,我在这方面遇到了很多问题 我要做的基本上是让Excel解析一个区域单元格的内容,如果内容不等于“OWNED”,则将其复制到另一列。实际上,我不知道该怎么做,我一直在尝试在互联网上找到的不同宏,但它们似乎都不适用于我需要的东西,而且我缺乏完成这项工作的知识,因此如果有人帮我一把,或者至少为我指明了正确的方向,我将不胜感激 所以基本上我是想从中受益 对此 正如你所看到的,我需要这个程序在第一列中不留空单元格 我将非常感谢能够帮助我的人,这几周来一直让我发疯:/ 提前谢谢 编辑:添加代码 Sub

我在这方面遇到了很多问题

我要做的基本上是让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
试试这个

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
子更新()
将wb设置为工作簿
将ws设置为工作表
设置wb=ActiveWorkbook
设置ws=wb.Sheets(“Hoja1”)
Dim UninstalledColumn作为字符串
Dim UninstalledRow作为整数
卸载列=“A”
UninstalledRow=3
这是分配范围的方式,但您不需要这样。
'将卸载的单元格作为范围
'Set UninstalledCell=ws.Range(UninstalledColumn&UninstalledRow)
Dim WorkstationList As范围
设置WorkstationList=ws.Range(“C3:C12”)
对于工作站列表中的每个cel
如果cel.Value“拥有”,则
ws.Cells(UninstalledRow,UninstalledColumn)=cel.Value
UninstalledRow=UninstalledRow+1
如果结束
下一个细胞
端接头
试试这个

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
子更新()
将wb设置为工作簿
将ws设置为工作表
设置wb=ActiveWorkbook
设置ws=wb.Sheets(“Hoja1”)
Dim UninstalledColumn作为字符串
Dim UninstalledRow作为整数
卸载列=“A”
UninstalledRow=3
这是分配范围的方式,但您不需要这样。
'将卸载的单元格作为范围
'Set UninstalledCell=ws.Range(UninstalledColumn&UninstalledRow)
Dim WorkstationList As范围
设置WorkstationList=ws.Range(“C3:C12”)
对于工作站列表中的每个cel
如果cel.Value“拥有”,则
ws.Cells(UninstalledRow,UninstalledColumn)=cel.Value
UninstalledRow=UninstalledRow+1
如果结束
下一个细胞
端接头

如果您需要代码方面的帮助,您必须发布代码。刚才添加了我到目前为止的内容。我在第16行遇到一个错误,说object required(对象必需)。如果您需要代码方面的帮助,您必须发布您的代码。刚才添加了我到目前为止的内容。我在第16行得到一个错误,说需要对象。非常感谢,这正是我需要的。再次感谢你的帮助!非常感谢,这正是我所需要的。再次感谢你的帮助!