![]() |
#33
|
||||
|
||||
![]()
Oh, I don't want you to give up on TextToColumns; I just didn't want to talk about it much until we'd covered some more basic things. Maybe I still don't; I'm thinking.
But you're pretty insistent, even to the extent of deleting your previous posts so I couldn't be distracted by them. You may be biting off more than you can chew just yet, but I gotta respect your determination, so let's give it a try. Start here: Do you have those links I gave you? One of them, this one, is for the objects, properties, methods and events (and other stuff) available to VBA in the Excel application. That's where you'll find official documentation of TextToColumns. Now, the problem with this link is that it starts with just a list of objects: Worksheets, Error, Hyperlinks, Comments and tons of stuff that I never heard of. None of them are named "TextToColumns". If you ask that page to do a search for "TextToColumns", you'll find—at least I find—lots of articles that mention TextToColumns, but they vary in quality and sometimes I can spend all day trying to understand an article only to realize that it's for Visual Basic Studio or written for C# or something. Very frustrating. Nevertheless, a search is sometimes your only recourse. But I won't make you search for the relevant article. (I'll just make you read it, once we find it.) I happen to know that TextToColumns is a "method" of the Range object. So start here: Go to that link, and scroll down until you find the Range object mentioned. Click on that. Don't click on the Ranges object, plural; we want the singular. (Don't worry about which list of objects to use; the left and right are both the same. At least, I've never noticed any difference.) Once you're there you'll see a choice of four links: "Range Object (Excel)", "Range Members (Excel)", "Properties" and "Methods". You should at least read the "Range Object (Excel)" article; it's short and gives background. But for TextToColumns I recommend you click on "Range Members (Excel)" and then look through the resulting list of Methods in the first section. They're alphabetically arranged, so you won't have any difficulty finding TextToColumns. The resulting page shows the arguments you use to control the TextToColumns method and a very little about what it does. But it's the right place to start to understand how to do TextToColumns in VBA. I'm not abandoning you here; I'll still answer questions, either about the documentation itself or about your attempts to make TextToColumns work in your program. But make as much sense as you can of that article, to start with. You seem to be pretty self-reliant, so I'm sure it'll help you some. Then ask some more. ...And as for the questions you already asked: Quote:
I gather you know the difference between a subroutine and a function. But both of them are alike in one way: They're available to use anywhere; you can give them any arguments and they'll work as designed. A method, on the other hand, isn't a general routine that you can call like this: Code:
x = MyFunction(Cells("E2"), 3.14159) To answer another part of your question, no; the TextToColumns method is more like a subroutine than a function, because it doesn't (so far as I know) return a result, it just performs the action. As for your code: Code:
Selection.TextToColumns Destination = Range("E2") DataType = xlFixedWidth FieldInfo = Array(Array(0, 9), Array(3, 3)) Code:
Selection.TextToColumns Destination:=Range("E2"), DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 9), Array(3, 3)) Code:
Selection.TextToColumns Destination:=Range("E2"), DataType:=xlFixedWidth, _ FieldInfo:=Array(Array(0, 9), Array(3, 3)) |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Formatting contents after Tab of continuous lines or formatting specific area of word | pawii | Word | 1 | 05-12-2014 05:24 AM |
macros | stebrownsword | Word VBA | 0 | 08-28-2013 01:16 AM |
![]() |
anju16saini | Word VBA | 1 | 03-11-2013 04:15 AM |
![]() |
WaltR | Word VBA | 8 | 05-15-2012 06:28 PM |
Macros | nore | Outlook | 0 | 06-01-2011 04:39 PM |