0

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

enter image description here

to this

enter image description here

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
2
  • If you want help with your code, you'll have to post your code. Commented Jan 30, 2017 at 23:53
  • Just added what I have so far. I'm getting an error saying object required on line 16 Commented Jan 31, 2017 at 0:16

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, that was just what I needed. Thanks again for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.