Reputation: 13
I'm experiencing a lot of issues with this.
What I'm trying to do is basically get Excel to parse a range cell's contents and if the content doesn't equal "OWNED", copy it to another column. I actually have no idea what to do, been experimenting with different macros I found around the internet but none of them seemed to apply for what I need and I lack the knowledge to get this done, so I would appreciate if someone lent me a hand or at least pointed me in the right direction.
So basically I'm trying to get from this
to this
and as you can see, I would need the program to not spare empty cells on the first column.
I will be very grateful to someone who can lend me a hand on this, it's been making me crazy for weeks :/
Thanks in advance.
EDIT: ADDED CODE
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
Upvotes: 0
Views: 1442
Reputation: 35970
Try this
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
Upvotes: 2