PC Review


Reply
Thread Tools Rate Thread

Macro to put info into certain columns based on info in another co

 
 
Studebaker
Guest
Posts: n/a
 
      4th Dec 2007
I just got news that I need to add more info to a huge spreadsheet and I
really need a macro to do this for me to save time.

I have invoice #s in column L that are formatted like this:
701025467 means that
7 = 2007
01 = 1st month (January)
02 = 2nd period of January (16th thru the 31st)

612017766 means that
6 - 2006
12 - 12th month (December)
01 - 1st period of December (1st thru the 15th)

I need a visual basic code that will identify:

1) if the invoice # in column L starts with a '7' then the year "2007" needs
to be added to the same row in column O. If starts with a '6' then the year
"2006" needs to be added to the same row in column O.

2) if the invoice #'s next 2 #s in column L are '01' then the month "01"
needs to be added to the same row in the column M. If the next 2 #s are '02'
instead then the month "02" needs to added to the same row in the column M,
etc., etc. up to '12' for the 12th month.

3) if the invoice #'s 4th and 5th #s in column L are '02' then the period
"2nd" needs to added to the same row in the column N. Ff the invoice #'s 4th
and 5th #s in column L are '01' instead then the period "1st" needs to added
to the same row in the column N.

Thank you very much!


 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      4th Dec 2007
something like
for i = 2 to cells(rows.count,"L").end(xlup).row
cells(i,"o").value= "200" & left(cells(i,"L")
cells(i,"m").value=mid(cells(i,"l"),2,2)
'etc
next i

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Studebaker" <(E-Mail Removed)> wrote in message
news:E6D4ABE8-2635-4A5D-A32C-(E-Mail Removed)...
>I just got news that I need to add more info to a huge spreadsheet and I
> really need a macro to do this for me to save time.
>
> I have invoice #s in column L that are formatted like this:
> 701025467 means that
> 7 = 2007
> 01 = 1st month (January)
> 02 = 2nd period of January (16th thru the 31st)
>
> 612017766 means that
> 6 - 2006
> 12 - 12th month (December)
> 01 - 1st period of December (1st thru the 15th)
>
> I need a visual basic code that will identify:
>
> 1) if the invoice # in column L starts with a '7' then the year "2007"
> needs
> to be added to the same row in column O. If starts with a '6' then the
> year
> "2006" needs to be added to the same row in column O.
>
> 2) if the invoice #'s next 2 #s in column L are '01' then the month "01"
> needs to be added to the same row in the column M. If the next 2 #s are
> '02'
> instead then the month "02" needs to added to the same row in the column
> M,
> etc., etc. up to '12' for the 12th month.
>
> 3) if the invoice #'s 4th and 5th #s in column L are '02' then the period
> "2nd" needs to added to the same row in the column N. Ff the invoice #'s
> 4th
> and 5th #s in column L are '01' instead then the period "1st" needs to
> added
> to the same row in the column N.
>
> Thank you very much!
>
>


 
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
Convert Columns to Rows and insert into another table based on valuesin columns Gurvinder Microsoft Access Form Coding 7 25th Nov 2008 11:03 PM
Convert Columns to Rows and insert into another table based on valuesin columns Gurvinder Microsoft Access Queries 0 24th Nov 2008 10:00 PM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Microsoft Excel Discussion 2 23rd Jun 2005 11:40 PM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Microsoft Excel Worksheet Functions 1 23rd Jun 2005 11:38 PM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Microsoft Excel Discussion 0 23rd Jun 2005 11:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:55 PM.