PrettyMess
Board Regular
- Joined
- Feb 10, 2015
- Messages
- 66
Hi All,
I am struggling a bit with this code, I haven't ever had to reference one column and copy and paste to another tab in VBA so here goes..
I have an excel document with a table on it similar to below:
Colm A Colm B
Nicola Internet
Email
Graham Phone
Email
I need my code to look in column A find the first name in this case Nicola I then want it to look at column B and check to see if she has the word "Internet" appear in any of the records stored against her, as she does the code will ignore her and move down to the next name on the list. In this case Graham it will then look to column B and check if he has the word "Internet" as he doesn't I would then like it to lift the Information from column A & B in relation to this persons name and paste the information into another tab on my workbook.
Any help would be greatly appreciated.
Thanks
Paula
I am struggling a bit with this code, I haven't ever had to reference one column and copy and paste to another tab in VBA so here goes..
I have an excel document with a table on it similar to below:
Colm A Colm B
Nicola Internet
Graham Phone
I need my code to look in column A find the first name in this case Nicola I then want it to look at column B and check to see if she has the word "Internet" appear in any of the records stored against her, as she does the code will ignore her and move down to the next name on the list. In this case Graham it will then look to column B and check if he has the word "Internet" as he doesn't I would then like it to lift the Information from column A & B in relation to this persons name and paste the information into another tab on my workbook.
Code:
Sub Test3()
Dim x As String
Dim found As Boolean
Range("B2").Select
x = "Internet"
found = False
Do Until IsEmpty(ActiveCell)
If ActiveCell.Value = x Then
found = True
Exit Do
End If
ActiveCell.Offset(1, 0).Select
Loop
If found = False Then
Sheets("Groupings").Activate
Sheets("Groupings").Range("A:B").Select
Selection.Copy
Sheets("Sheet1").Select
Sheets("Sheet1").Range("A:B").PasteSpecial
End If
End Sub
Any help would be greatly appreciated.
Thanks
Paula