How do I please

S

Steved

Hello from Steved
Panmure 10903 27 54.04 200511
Panmure 10915 27 45.80 200511
Panmure 10913 24 43.80 200511
Panmure 10886 23 47.60 200511
Panmure 10922 21 41.47 200511
Panmure 10884 20 38.90 200511

The above is in sheet called Data

I've named 8 sheets with City names

The above is "Panmure" City what formula would I use please
to copy from Data Sheet to the Panmure Sheet.

Thankyou.
 
S

Steved

Hello from Steved

Below is what I tried but is giving me a error 400
Thankyou.

Sub CopyData()

Dim LRow As Integer
Dim LColARange As String
Dim LContinue As Boolean

'Select Sheet1
Sheets("Data").Select
Range("Panmure").Select

'Initialize variables
LContinue = True
LRow = 2

'Loop through all column A values until a blank cell
is found or value does not
' match cell A2's value
While LContinue = True

LRow = LRow + 1
LColARange = "A" & CStr(LRow)

'Found a blank cell, do not continue
If Len(Range(LColARange).Value) = 0 Then
LContinue = False
End If

'Found first occurrence that did not match cell
A2's value, do not continue
If Range("Panmure").Value <> Range
(LColARange).Value Then
LContinue = False
End If

Wend

'Copy data from columns A - C
Range("A2:E" & CStr(LRow - 1)).Select
Selection.Copy

'Paste results to cell A1 in Sheet2
Sheets("Panmure").Select
Range("A1").Select
ActiveSheet.Paste

MsgBox "Copy has completed."

End Sub
 
S

Steved

Thankyou
-----Original Message-----
Perhaps you'd like to try a formulas approach which closely fits what you
seem to be after? If so, think you could adapt quite easily the set-up
described in this recent post: http://tinyurl.com/5ejr2

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <at>yahoo<dot>com
----



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top