Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Frantic Excel-er
 
Posts: n/a
Default

Bob --- one more question about the array...

for these values I am entering..I actually am making 2 lookup tables...the
first is values for "USB" - 1,2,3,4..Etc, and that is in column A, Col. B has
"Ok, down to B9, then "India" only in B9, then okay again from B10 to B34 ,
then in Column D i have values for "FAS" - 1,2,3,4,..etc, and then I have in
column E "OK" from E2 to E61...

so when the macro is executed, it looks something like this:
ColA ColB ColC ColD ColE
USB FAS
04165 OK 04165 OK
14709 OK 14014 OK
14716 OK 14016 OK
24704 OK 24013 OK
44705 OK 24017 OK
44710 OK 24019 OK

Also, the code for making the macro list account numbers is in my first
thread...

Once all the accounts are "typed" by the macro, I then name the two blocks
of items so that I can do vlookups with them...Code looks like this for the
naming:

Range("A2:B34").Select
Range("B34").Activate
ActiveWorkbook.Names.Add Name:="USB", RefersToR1C1:= _
"='Lookup Tables'!R2C1:R34C2"
ActiveWindow.SmallScroll Down:=28
Range("D2:E61").Select
Range("E61").Activate
ActiveWorkbook.Names.Add Name:="FAS", RefersToR1C1:= _
"='Lookup Tables'!R2C4:R61C5"

Would making the lists of accounts I have above into an array and naming
them so that vlookup would work be possible???? If so, how would it look?????

Thanks a bunch for all your help....I am really trying hard to learn this
stuff!!!!!!!

Sara





"Bob Phillips" wrote:

There is no pattern to the values so the simplest thing is to simplify the
code

Range("A1").Value = "USB"
Range("A2").Value = "04165"
Range("A3").Value = "14709"
Range("A4").Value = "14716"
Range("A5").Value = "24704"
Range("A6").Value = "44705"
Range("A7").Value = "44710"

You could also load an array

aryValues = Array("USB", "04165", "14709", "14716", "24704", "44705",
"44710")
For i = 0 To UBound(aryValues)
Range("A" & i + 1).Value = aryValues(i)
Next i


--
HTH

Bob Phillips

"Frantic Excel-er" wrote in
message ...
Hi All...

I have code that contains the following:

ActiveCell.FormulaR1C1 = "USB"
Range("A2").Select
ActiveCell.FormulaR1C1 = "04165"
Range("A3").Select
ActiveCell.FormulaR1C1 = "14709"
Range("A4").Select
ActiveCell.FormulaR1C1 = "14716"
Range("A5").Select
ActiveCell.FormulaR1C1 = "24704"
Range("A6").Select
ActiveCell.FormulaR1C1 = "44705"
Range("A7").Select
ActiveCell.FormulaR1C1 = "44710"

and it goes on to enter the associated text on the next line...all the way
down to 60 rows. Is there a way that I can consolidate these steps where

the
macro will automatically know to put the text in the next rows......for
example....
MACRO CODE = Enter Text, start A1...FAS,12354, 23456








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
Find the cell value in excel by using vb code Michael Excel Discussion (Misc queries) 5 June 14th 05 01:24 PM
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 4th 05 10:50 AM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 3rd 05 03:40 PM
Trim function doesn't clean out ASCII Code 160 (Space) Ronald Dodge Excel Worksheet Functions 6 January 27th 05 03:48 AM


All times are GMT +1. The time now is 04:17 AM.

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"