Task for attached link:
https://drive.google.com/file/d/0B23eJ2xd9ODyUEtOVk4zRWt4VDA/edit?usp=sharing
https://drive.google.com/file/d/0B23eJ2xd9ODyUEtOVk4zRWt4VDA/edit?usp=sharing
Want to cut all these HQ names from column B and paste
them to the very next column C
VBA Code
Option Explicit
Dim lookupval As String, myrng As Range, firstaddress As String
Sub copyHOnamelist()
lookupval = "HQ Name:"
With ThisWorkbook.Sheets(1).Range("A:A")
Set myrng = .Find(lookupval, LookIn:=xlValues)
If Not myrng Is Nothing Then
firstaddress = myrng.Address
Do
myrng.Offset(0, 1).Cut Destination:=myrng.Offset(0, 2)
Set myrng = .FindNext(myrng)
Loop While Not myrng Is Nothing And myrng.Address <> firstaddress
End If
End With
End Sub
Option Explicit
Dim lookupval As String, myrng As Range, firstaddress As String
Sub copyHOnamelist()
lookupval = "HQ Name:"
With ThisWorkbook.Sheets(1).Range("A:A")
Set myrng = .Find(lookupval, LookIn:=xlValues)
If Not myrng Is Nothing Then
firstaddress = myrng.Address
Do
myrng.Offset(0, 1).Cut Destination:=myrng.Offset(0, 2)
Set myrng = .FindNext(myrng)
Loop While Not myrng Is Nothing And myrng.Address <> firstaddress
End If
End With
End Sub
No comments:
Post a Comment