Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to copy only certain text

Column A has 3,500 rows with lots of excess text,below is
some example text.
I need any row that says "MAC Address = " and the two rows
above it, copied onto sheet 2. Basically the only
information I need is, the MAC Address and Username all
other text is useless.
Thanks,
Melissa

Ex.
H:\nbtstat -a 10.22.23.22

Local Area Connection:
Node IpAddress: [10.22.2.193] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
WDMECH001839
NADSUSEA
WDMECH001839
WDMECH001839
WDMECH001839$
NADSUSEA
JOANNE.EMELOP

MAC Address = 00-08-74-CB-A7-96


H:\nbtstat -a 10.22.23.23

Local Area Connection:
Node IpAddress: [10.22.2.193] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
WDMECH001384
NADSUSEA
NADSUSEA
WDMECH001384
WDMECH001384
JOSEPH.RESSLER

MAC Address = 00-08-74-C9-9E-D0


H:\nbtstat -a 10.22.23.24



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro to copy only certain text

Sub CopyData()
Dim rng as Range, rw as Long, fAddr as String
rw = 1
set rng = cells.Find("MAC Address", Lookat:=xlpart)
if not rng is nothing then
fAddr = rng.Address
do
rng.offset(-2,0).Resize(3).copy _
destination:=worksheets("Sheet2").Cells(rw,1)
rw = rw + 3
set rng = cells.FindNext(rng)
while rng.Address < fAddr
End if
End Sub

--
Regards,
Tom Ogilvy



"Melissa" wrote in message
...
Column A has 3,500 rows with lots of excess text,below is
some example text.
I need any row that says "MAC Address = " and the two rows
above it, copied onto sheet 2. Basically the only
information I need is, the MAC Address and Username all
other text is useless.
Thanks,
Melissa

Ex.
H:\nbtstat -a 10.22.23.22

Local Area Connection:
Node IpAddress: [10.22.2.193] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
WDMECH001839
NADSUSEA
WDMECH001839
WDMECH001839
WDMECH001839$
NADSUSEA
JOANNE.EMELOP

MAC Address = 00-08-74-CB-A7-96


H:\nbtstat -a 10.22.23.23

Local Area Connection:
Node IpAddress: [10.22.2.193] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
WDMECH001384
NADSUSEA
NADSUSEA
WDMECH001384
WDMECH001384
JOSEPH.RESSLER

MAC Address = 00-08-74-C9-9E-D0


H:\nbtstat -a 10.22.23.24





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to copy only certain text

I am getting the Microsoft Visual Basica error:
Compile error:
End If without block If

I am positive I type it out correctly...
Melissa
-----Original Message-----
Sub CopyData()
Dim rng as Range, rw as Long, fAddr as String
rw = 1
set rng = cells.Find("MAC Address", Lookat:=xlpart)
if not rng is nothing then
fAddr = rng.Address
do
rng.offset(-2,0).Resize(3).copy _
destination:=worksheets("Sheet2").Cells(rw,1)
rw = rw + 3
set rng = cells.FindNext(rng)
while rng.Address < fAddr
End if
End Sub

--
Regards,
Tom Ogilvy



"Melissa" wrote in

message
...
Column A has 3,500 rows with lots of excess text,below

is
some example text.
I need any row that says "MAC Address = " and the two

rows
above it, copied onto sheet 2. Basically the only
information I need is, the MAC Address and Username all
other text is useless.
Thanks,
Melissa

Ex.
H:\nbtstat -a 10.22.23.22

Local Area Connection:
Node IpAddress: [10.22.2.193] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
WDMECH001839
NADSUSEA
WDMECH001839
WDMECH001839
WDMECH001839$
NADSUSEA
JOANNE.EMELOP

MAC Address = 00-08-74-CB-A7-96


H:\nbtstat -a 10.22.23.23

Local Area Connection:
Node IpAddress: [10.22.2.193] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
WDMECH001384
NADSUSEA
NADSUSEA
WDMECH001384
WDMECH001384
JOSEPH.RESSLER

MAC Address = 00-08-74-C9-9E-D0


H:\nbtstat -a 10.22.23.24





.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro to copy only certain text

The keywork Loop got left out.

Sub CopyData()
Dim rng As Range, rw As Long, fAddr As String
rw = 1
Set rng = Cells.Find("MAC Address", Lookat:=xlPart)
If Not rng Is Nothing Then
fAddr = rng.Address
Do
rng.Offset(-2, 0).Resize(3).Copy _
Destination:=Worksheets("Sheet2").Cells(rw, 1)
rw = rw + 3
Set rng = Cells.FindNext(rng)
Loop While rng.Address < fAddr
End If
End Sub


--
Regards,
Tom Ogilvy

"Melissa" wrote in message
...
I am getting the Microsoft Visual Basica error:
Compile error:
End If without block If

I am positive I type it out correctly...
Melissa
-----Original Message-----
Sub CopyData()
Dim rng as Range, rw as Long, fAddr as String
rw = 1
set rng = cells.Find("MAC Address", Lookat:=xlpart)
if not rng is nothing then
fAddr = rng.Address
do
rng.offset(-2,0).Resize(3).copy _
destination:=worksheets("Sheet2").Cells(rw,1)
rw = rw + 3
set rng = cells.FindNext(rng)
while rng.Address < fAddr
End if
End Sub

--
Regards,
Tom Ogilvy



"Melissa" wrote in

message
...
Column A has 3,500 rows with lots of excess text,below

is
some example text.
I need any row that says "MAC Address = " and the two

rows
above it, copied onto sheet 2. Basically the only
information I need is, the MAC Address and Username all
other text is useless.
Thanks,
Melissa

Ex.
H:\nbtstat -a 10.22.23.22

Local Area Connection:
Node IpAddress: [10.22.2.193] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
WDMECH001839
NADSUSEA
WDMECH001839
WDMECH001839
WDMECH001839$
NADSUSEA
JOANNE.EMELOP

MAC Address = 00-08-74-CB-A7-96


H:\nbtstat -a 10.22.23.23

Local Area Connection:
Node IpAddress: [10.22.2.193] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
WDMECH001384
NADSUSEA
NADSUSEA
WDMECH001384
WDMECH001384
JOSEPH.RESSLER

MAC Address = 00-08-74-C9-9E-D0


H:\nbtstat -a 10.22.23.24





.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to copy text between two different delimeters [email protected] New Users to Excel 1 April 6th 07 03:54 PM
copy text from 1 workbook to another by macro bigdaddy3 Excel Worksheet Functions 0 August 17th 05 06:20 PM
Macro to delete a text box and copy in new one Dave Excel Discussion (Misc queries) 1 February 18th 05 02:02 AM
Macro to copy text from ColumnA to B Sarah[_4_] Excel Programming 4 July 30th 04 08:55 PM
Macro to copy daily text file Cheryl[_4_] Excel Programming 1 May 27th 04 05:46 AM


All times are GMT +1. The time now is 06:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"