PC Review


Reply
Thread Tools Rate Thread

Change the structure of words?

 
 
StargateFan
Guest
Posts: n/a
 
      10th Aug 2009
Is there a way to change this input:

twenty four Number of hours for earth to rotate around its axis.
laser Monochromatic light
proton Positively charged particle of an atom.
acceleration Force equals mass times ____________.




To this format which can then be picked up by a program?

twenty four
laser
proton
acceleration
*
Number of hours for earth to rotate around its axis.
Monochromatic light
Positively charged particle of an atom.
Force equals mass times ____________.



In essence, a script would take all the words in column A and spread
them vertically over rows instead.

Then the next row after that would have an aseterisk, as shown above.

And then all the explanations of the words/phrases in column B would
be listed vertically, also now in column A, underneath the asterisk.

I could do this manually but I have many rows to work with and it
would be quite time-consuming.

Thank you so much! D

 
Reply With Quote
 
 
 
 
StargateFan
Guest
Posts: n/a
 
      10th Aug 2009
On Sun, 09 Aug 2009 22:33:29 -0500, StargateFan
<IDon'(E-Mail Removed)> wrote:

>Is there a way to change this input:
>
>twenty four Number of hours for earth to rotate around its axis.
>laser Monochromatic light
>proton Positively charged particle of an atom.
>acceleration Force equals mass times ____________.
>
>
>
>
>To this format which can then be picked up by a program?
>
>twenty four
>laser
>proton
>acceleration
>*
>Number of hours for earth to rotate around its axis.
>Monochromatic light
>Positively charged particle of an atom.
>Force equals mass times ____________.


[snip]

Oops, forgot to mention that row A is a header row. Sorry. <g>

 
Reply With Quote
 
Sam Wilson
Guest
Posts: n/a
 
      10th Aug 2009
sub test()

dim i as integer


with range("A2")
for i = 0 to 3
.offset(i,3).value = .offset(i,0).value
.offset(i+5,3).value = .offset(i,1).value
next i
.offset(4,3).value = "*"
end with


end sub

"StargateFan" wrote:

> On Sun, 09 Aug 2009 22:33:29 -0500, StargateFan
> <IDon'(E-Mail Removed)> wrote:
>
> >Is there a way to change this input:
> >
> >twenty four Number of hours for earth to rotate around its axis.
> >laser Monochromatic light
> >proton Positively charged particle of an atom.
> >acceleration Force equals mass times ____________.
> >
> >
> >
> >
> >To this format which can then be picked up by a program?
> >
> >twenty four
> >laser
> >proton
> >acceleration
> >*
> >Number of hours for earth to rotate around its axis.
> >Monochromatic light
> >Positively charged particle of an atom.
> >Force equals mass times ____________.

>
> [snip]
>
> Oops, forgot to mention that row A is a header row. Sorry. <g>
>
>

 
Reply With Quote
 
StargateFan
Guest
Posts: n/a
 
      10th Aug 2009
On Mon, 10 Aug 2009 00:48:01 -0700, Sam Wilson
<(E-Mail Removed)> wrote:

>sub test()
>
>dim i as integer
>
>
>with range("A2")
> for i = 0 to 3
> .offset(i,3).value = .offset(i,0).value
> .offset(i+5,3).value = .offset(i,1).value
> next i
> .offset(4,3).value = "*"
>end with
>
>
>end sub


Thank you! Will give this a try later today. D

>"StargateFan" wrote:
>
>> On Sun, 09 Aug 2009 22:33:29 -0500, StargateFan
>> <IDon'(E-Mail Removed)> wrote:
>>
>> >Is there a way to change this input:
>> >
>> >twenty four Number of hours for earth to rotate around its axis.
>> >laser Monochromatic light
>> >proton Positively charged particle of an atom.
>> >acceleration Force equals mass times ____________.
>> >
>> >
>> >
>> >
>> >To this format which can then be picked up by a program?
>> >
>> >twenty four
>> >laser
>> >proton
>> >acceleration
>> >*
>> >Number of hours for earth to rotate around its axis.
>> >Monochromatic light
>> >Positively charged particle of an atom.
>> >Force equals mass times ____________.

>>
>> [snip]
>>
>> Oops, forgot to mention that row A is a header row. Sorry. <g>
>>
>>


 
Reply With Quote
 
StargateFanNotAtHome
Guest
Posts: n/a
 
      10th Aug 2009
Thanks, it works a treat. It sends the text to outside the print area
and in dark cells into column D, but I can certainly live with that,
esp. considering the alternative. But what a marvellous bit of code.
I played with it, as I always do, when I get new code, but I'm just
not very good at scripting (even after all these years!!! <g>).

I just finetuned the script since I thought it would be easier to just
delete a sheet with the modified text than go back and erase the
output, even though I could script that, too. Just seems easier to
create a copy of the sheet.

***************************************
Sub Create_WordList()
ActiveSheet.Protect ' this makes sure main sheet is
protected

Application.Goto Reference:="R2C1"

Dim i As Integer

'Sheets("WordSheets wordlist maker").copy After:=Sheets(1)
ActiveSheet.copy After:=Sheets(1)
ActiveSheet.Unprotect 'place at the beginning of the code
Application.Goto Reference:="R1C1"

With Range("A2")
For i = 0 To 3
.Offset(i, 3).Value = .Offset(i, 0).Value
.Offset(i + 5, 3).Value = .Offset(i, 1).Value
Next i
.Offset(4, 3).Value = "*"
End With

Application.Goto Reference:="R2C1"

ActiveSheet.Protect ' place at end of code
End Sub
***************************************
Thanks! D
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to change my structure in Db Bob Vance Microsoft Access 1 20th Apr 2009 11:09 AM
Re: Change Table Structure Tim Ferguson Microsoft Access VBA Modules 1 8th Jan 2007 04:49 PM
Re: Change Table Structure Alex Dybenko Microsoft Access VBA Modules 0 6th Jan 2007 07:10 AM
Re: How can I change a structure of an autonumber? Joseph Meehan Microsoft Access 0 24th Aug 2004 01:17 AM
Re: How can I change a structure of an autonumber? Douglas J. Steele Microsoft Access 0 23rd Aug 2004 10:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:03 AM.