LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Sub will not find Column "A"

Hi Everybody

The following ( there could be up to 400 lines) is received as an attachment
in an Email the attachment is in Notepad. Which I Cut and paste into Excel.
4100,WM7886,255,1404
4100,WM5589,255,1473
4100,WM6458,253,1230
4100,WM6467,254,966
using the following macro

Sub Macro3()

Sheets("main").Select
Selection.TextToColumns Destination:=Range("F2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, Other:=True,
FieldInfo:= _
Array(Array(1, 9), Array(2, 1), Array(3, 1), Array(4, 1)),
TrailingMinusNumbers:= _
True


Range("F2:H4").Select
Selection.Cut
Range("A2").Select
ActiveSheet.Paste
End Sub

I then use the following code I asked help for last week and Patrick Molloy
kindly helped and it worked OK --- however having a strange problem after cut
and paste to column "A" I now find the sub will not insert the data into the
respective rows and sheets apparently because it cannot find column "A" ---
however if I manually enter the data in Col "A" e.g. WM7886 it finds the
correct row and col and inserts the other cols of data. have tried changing
from text to general and number in Format cells all to no avail.

Option Explicit
Sub PopData()
Sheets("main").Select
Dim source As Range
Dim ws As Worksheet
Dim cell As Range
Dim index As Long
For Each ws In Worksheets
If ws.Name < "main" Then
For Each cell In Range(Range("A2"), Range("A2").End(xlDown))
index = matched(cell.Value, ws)
If index 0 Then
ws.Cells(index, 200).End(xlToLeft).Offset(0, 1) = cell.Offset(, 1)
ws.Cells(index, 200).End(xlToLeft).Offset(0, 1) = cell.Offset(, 2)
End If
Next 'item
End If
Next 'sheet
End Sub
Function matched(item As String, ws As Worksheet) As Long
On Error Resume Next
matched = WorksheetFunction.Match(item, ws.Columns(1), False)
On Error GoTo 0
End Function

Has anybody any idea's


--
Many thanks

hazel
 
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
"Find" a wildcard as a place marker and "replace" with original va Eric Excel Discussion (Misc queries) 1 January 27th 09 06:00 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Please add a "sheet" function like "row" and "column" functions Spreadsheet Monkey Excel Programming 2 November 8th 05 04:08 PM
How do I split "A1B2" into "A1" and "B2" using text to column fun. Jennifer Excel Programming 1 February 2nd 05 10:01 PM


All times are GMT +1. The time now is 08:13 PM.

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

About Us

"It's about Microsoft Excel"