Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 57
Default Macro to put info into certain columns based on info in another co

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!


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Macro to put info into certain columns based on info in another co

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

"Studebaker" wrote in message
...
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
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
How do I sort by info in one column and it stay in line with info stephanie Excel Worksheet Functions 2 March 14th 07 05:43 PM
varying validation info based on preceding info georgejl Excel Discussion (Misc queries) 1 November 9th 06 10:31 PM
Tables, How do I make new info push existing info to the next row? PeteL Excel Worksheet Functions 1 April 16th 06 09:46 PM
Link info in one cell to info in several cells in another column (like a database) hansdiddy Excel Discussion (Misc queries) 1 February 22nd 06 02:27 AM
how do i get excel to see info in one cell, look at info in anoth. ditto Excel Discussion (Misc queries) 3 February 1st 05 04:37 PM


All times are GMT +1. The time now is 02:26 AM.

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

About Us

"It's about Microsoft Excel"