PC Review


Reply
Thread Tools Rate Thread

How to define variable a("H") = "Follow-up"...

 
 
moonhk
Guest
Posts: n/a
 
      2nd Oct 2009

Hi All

IN VBA,How to define variable a("H") = "Follow-up"...
e.g.
a["A"] = "Follow-up"
a["B"] ="Reject"
a["C"]="Ongoing"
....



moonhkt
 
Reply With Quote
 
 
 
 
Patrick Molloy
Guest
Posts: n/a
 
      2nd Oct 2009
Range("A1").Value = "abc"

better:

Worksheets("Sheet1").Range("A1").Value = "abc"



"moonhk" wrote:

>
> Hi All
>
> IN VBA,How to define variable a("H") = "Follow-up"...
> e.g.
> a["A"] = "Follow-up"
> a["B"] ="Reject"
> a["C"]="Ongoing"
> ....
>
>
>
> moonhkt
>

 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      2nd Oct 2009
the code earlier assumed you wanted data in cells

maybe this suits the question better:

Dim col As Collection
Set col = New Collection
col.Add "following", "A"
col.Add "reject", "B"
MsgBox col("B")


"Patrick Molloy" wrote:

> Range("A1").Value = "abc"
>
> better:
>
> Worksheets("Sheet1").Range("A1").Value = "abc"
>
>
>
> "moonhk" wrote:
>
> >
> > Hi All
> >
> > IN VBA,How to define variable a("H") = "Follow-up"...
> > e.g.
> > a["A"] = "Follow-up"
> > a["B"] ="Reject"
> > a["C"]="Ongoing"
> > ....
> >
> >
> >
> > moonhkt
> >

 
Reply With Quote
 
moonhkt
Guest
Posts: n/a
 
      2nd Oct 2009
Hi All
Thank. It works.

Sub abc()

Dim col As Collection
Dim x As String
Set col = New Collection
col.Add "following", "A"
col.Add "reject", "B"
x = "B"
MsgBox col(x)
MsgBox col("A")
End Sub




On Oct 2, 5:44*pm, Patrick Molloy
<PatrickMol...@discussions.microsoft.com> wrote:
> the code earlier assumed you wanted data in cells
>
> maybe this suits the question better:
>
> Dim col As Collection
> Set col = New Collection
> col.Add "following", "A"
> col.Add "reject", "B"
> MsgBox col("B")
>
> "Patrick Molloy" wrote:
> > Range("A1").Value = "abc"

>
> > better:

>
> > Worksheets("Sheet1").Range("A1").Value = "abc"

>
> > "moonhk" wrote:

>
> > > Hi All

>
> > > IN VBA,How to define variable a("H") = "Follow-up"...
> > > e.g.
> > > a["A"] = "Follow-up"
> > > a["B"] ="Reject"
> > > a["C"]="Ongoing"
> > > ....

>
> > > moonhkt


 
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
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" =?Utf-8?B?THVj?= Microsoft Excel Programming 2 28th Sep 2005 08:37 PM
<FORM METHOD="post" onSubmit="return fieldcheck()" name="orientation" action="http://ws-kitty.BU.edu/AT/survey/orientation/script/write.asp" language="JavaScript"> Joeyej Microsoft ASP .NET 0 4th Jun 2004 08:55 PM
Manual "Windows Update" produces "ActiveX/active scripting" error message even with "LOW" security level setting in "Trusted" Zone Ray2 Windows XP Help 1 14th Nov 2003 06:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:01 PM.