Hi Mandeep,

 

Thank you very, very much your code works great and is exactly what I need.  I 
really appreciate your sense of urgency in getting this done so quickly, thank 
you again for all your help!

 

The Best,

 

MikeB

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On 
Behalf Of Mandeep Baluja
Sent: Saturday, May 02, 2015 11:54 PM
To: excel-macros@googlegroups.com
Subject: Re: $$Excel-Macros$$ Copying existing Address from column "B" to 
column "A" Using IF statement ( I think).

 

​​

Last line edited :) Now this will handle your requriement

 

Sub Test()

 

With Application

.ScreenUpdating = False

.DisplayAlerts = False

End With

 

Dim lr As Long

lr = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row

 

Set Rng = Range("b1:b" & lr)

Debug.Print Rng.Address

 

For Each cell In Rng

If Left(cell.Value, 15) = "Establishment :" Then

estab = cell

ElseIf Left(cell.Value, 2) <> "Es" Or cell.Value Like "*Total*" Then

cell.Offset(0, -1).Value = estab

Else

cell.Offset(0, -1).Value = ""

End If

Next

 

ActiveSheet.UsedRange.AutoFilter field:=2, Criteria1:="*Total*"

Set r = Range("B2:B" & lr).SpecialCells(xlCellTypeVisible)

Debug.Print r.Address

r.Replace what:="Establishment", Replacement:=""

ActiveSheet.ShowAllData

    ActiveSheet.UsedRange.AutoFilter field:=2, Criteria1:="*Establishment*"

ActiveSheet.Range("B2:B" & lr).SpecialCells(xlCellTypeVisible).EntireRow.Delete

ActiveSheet.ShowAllData

ActiveSheet.Range("A2:A" & lr).Replace what:="Establishment :", Replacement:=""

 

 

 

 

End Sub

 

 

On Sun, May 3, 2015 at 3:31 AM, Mike Barrett < <mailto:mikeb...@gmail.com> 
mikeb...@gmail.com> wrote:

Hi Mandeep,

 

Thank you very, very much for your help, your code works great!  The only thing 
is if you could tell me how to get rid of the word “Establishment” in column 
“A” so I am left with just the address without the word Establishment, I would 
really appreciate it.  Thank you again for all your help.

 

The Best,

 

Mike

 

 

 

 

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to a topic in the Google 
Groups "MS EXCEL AND VBA MACROS" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/excel-macros/wCioo-TG_uU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
excel-macros+unsubscr...@googlegroups.com 
<mailto:excel-macros+unsubscr...@googlegroups.com> .
To post to this group, send email to excel-macros@googlegroups.com 
<mailto:excel-macros@googlegroups.com> .
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to