PC Review


Reply
Thread Tools Rate Thread

code snippet below. Is there a shorter way to do this type of thin

 
 
Solutions Manager
Guest
Posts: n/a
 
      14th Jan 2009
Range("A1").Value = "email"
Range("B1").FormulaR1C1 = "type"
Range("C1").FormulaR1C1 = "employer_name"
Range("D1").FormulaR1C1 = "employer_url"
Range("E1").FormulaR1C1 = "employer_category"
Range("F1").FormulaR1C1 = "employer_logo"
Range("G1").FormulaR1C1 = "employer_bio"
Range("H1").FormulaR1C1 = "first_name"
Range("I1").FormulaR1C1 = "last_name"
Range("J1").FormulaR1C1 = "address_1"
Range("K1").FormulaR1C1 = "address_2"
Range("L1").FormulaR1C1 = "city"
Range("M1").FormulaR1C1 = "state"
Range("N1").FormulaR1C1 = "zip"
Range("O1").FormulaR1C1 = "password"
 
Reply With Quote
 
 
 
 
JBeaucaire
Guest
Posts: n/a
 
      14th Jan 2009
Since every cell is different, you do have to address each event, so the # of
lines probably can't shorten. But since there are no formulas to deal with,
you could change all the FormulaR1C1 references to just Value, like the first
line.
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Solutions Manager" wrote:

> Range("A1").Value = "email"
> Range("B1").FormulaR1C1 = "type"
> Range("C1").FormulaR1C1 = "employer_name"
> Range("D1").FormulaR1C1 = "employer_url"
> Range("E1").FormulaR1C1 = "employer_category"
> Range("F1").FormulaR1C1 = "employer_logo"
> Range("G1").FormulaR1C1 = "employer_bio"
> Range("H1").FormulaR1C1 = "first_name"
> Range("I1").FormulaR1C1 = "last_name"
> Range("J1").FormulaR1C1 = "address_1"
> Range("K1").FormulaR1C1 = "address_2"
> Range("L1").FormulaR1C1 = "city"
> Range("M1").FormulaR1C1 = "state"
> Range("N1").FormulaR1C1 = "zip"
> Range("O1").FormulaR1C1 = "password"

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      14th Jan 2009
Hi,

Maybe slightly better

myarr = Array("type", "employer_name", "employer_url", _
"employer_category", "employer_logo", "employer_bio", _
"first_name", "last_name", "address_1", "address_2", _
"city", "state", "Zip", "Password")
Range("B1:O1").Value = myarr

Mike

"Solutions Manager" wrote:

> Range("A1").Value = "email"
> Range("B1").FormulaR1C1 = "type"
> Range("C1").FormulaR1C1 = "employer_name"
> Range("D1").FormulaR1C1 = "employer_url"
> Range("E1").FormulaR1C1 = "employer_category"
> Range("F1").FormulaR1C1 = "employer_logo"
> Range("G1").FormulaR1C1 = "employer_bio"
> Range("H1").FormulaR1C1 = "first_name"
> Range("I1").FormulaR1C1 = "last_name"
> Range("J1").FormulaR1C1 = "address_1"
> Range("K1").FormulaR1C1 = "address_2"
> Range("L1").FormulaR1C1 = "city"
> Range("M1").FormulaR1C1 = "state"
> Range("N1").FormulaR1C1 = "zip"
> Range("O1").FormulaR1C1 = "password"

 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      14th Jan 2009
One way:

Range("A1:O1") = Array("email", "type", "employer_name", _
"employer_url", "employer_category", _
"employer_logo", "employer_bio", "first_name", _
"last_name", "address_1", "address_2", _
"city", "state", "zip", "password")

or, better (at least, more flexible):

Dim vArr As Variant
vArr = Array("email", "type", "employer_name", _
"employer_url", "employer_category", _
"employer_logo", "employer_bio", "first_name", _
"last_name", "address_1", "address_2", _
"city", "state", "zip", "password")
Range("A1").Resize(1, 1 + UBound(vArr) - LBound(vArr)).Value = vArr



In article <3BD13D00-DD55-463E-9585-(E-Mail Removed)>,
Solutions Manager <(E-Mail Removed)> wrote:

> Range("A1").Value = "email"
> Range("B1").FormulaR1C1 = "type"
> Range("C1").FormulaR1C1 = "employer_name"
> Range("D1").FormulaR1C1 = "employer_url"
> Range("E1").FormulaR1C1 = "employer_category"
> Range("F1").FormulaR1C1 = "employer_logo"
> Range("G1").FormulaR1C1 = "employer_bio"
> Range("H1").FormulaR1C1 = "first_name"
> Range("I1").FormulaR1C1 = "last_name"
> Range("J1").FormulaR1C1 = "address_1"
> Range("K1").FormulaR1C1 = "address_2"
> Range("L1").FormulaR1C1 = "city"
> Range("M1").FormulaR1C1 = "state"
> Range("N1").FormulaR1C1 = "zip"
> Range("O1").FormulaR1C1 = "password"

 
Reply With Quote
 
Solutions Manager
Guest
Posts: n/a
 
      14th Jan 2009
thank you. Just trying to shorten code where possible.
I also just had an idea that seemed to also work. I changed line one to all
the items separated by a comma, then used the text to columns command. the
resulting macro code was shorter...

"JBeaucaire" wrote:

> Since every cell is different, you do have to address each event, so the # of
> lines probably can't shorten. But since there are no formulas to deal with,
> you could change all the FormulaR1C1 references to just Value, like the first
> line.
> --
> "Actually, I *am* a rocket scientist." -- JB
>
> Your feedback is appreciated, click YES if this post helped you.
>
>
> "Solutions Manager" wrote:
>
> > Range("A1").Value = "email"
> > Range("B1").FormulaR1C1 = "type"
> > Range("C1").FormulaR1C1 = "employer_name"
> > Range("D1").FormulaR1C1 = "employer_url"
> > Range("E1").FormulaR1C1 = "employer_category"
> > Range("F1").FormulaR1C1 = "employer_logo"
> > Range("G1").FormulaR1C1 = "employer_bio"
> > Range("H1").FormulaR1C1 = "first_name"
> > Range("I1").FormulaR1C1 = "last_name"
> > Range("J1").FormulaR1C1 = "address_1"
> > Range("K1").FormulaR1C1 = "address_2"
> > Range("L1").FormulaR1C1 = "city"
> > Range("M1").FormulaR1C1 = "state"
> > Range("N1").FormulaR1C1 = "zip"
> > Range("O1").FormulaR1C1 = "password"

 
Reply With Quote
 
Solutions Manager
Guest
Posts: n/a
 
      14th Jan 2009
Thank you also. I will take this for a spin. I also appreciate the quick
response.

"Mike H" wrote:

> Hi,
>
> Maybe slightly better
>
> myarr = Array("type", "employer_name", "employer_url", _
> "employer_category", "employer_logo", "employer_bio", _
> "first_name", "last_name", "address_1", "address_2", _
> "city", "state", "Zip", "Password")
> Range("B1:O1").Value = myarr
>
> Mike
>
> "Solutions Manager" wrote:
>
> > Range("A1").Value = "email"
> > Range("B1").FormulaR1C1 = "type"
> > Range("C1").FormulaR1C1 = "employer_name"
> > Range("D1").FormulaR1C1 = "employer_url"
> > Range("E1").FormulaR1C1 = "employer_category"
> > Range("F1").FormulaR1C1 = "employer_logo"
> > Range("G1").FormulaR1C1 = "employer_bio"
> > Range("H1").FormulaR1C1 = "first_name"
> > Range("I1").FormulaR1C1 = "last_name"
> > Range("J1").FormulaR1C1 = "address_1"
> > Range("K1").FormulaR1C1 = "address_2"
> > Range("L1").FormulaR1C1 = "city"
> > Range("M1").FormulaR1C1 = "state"
> > Range("N1").FormulaR1C1 = "zip"
> > Range("O1").FormulaR1C1 = "password"

 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      14th Jan 2009
Hmm... somehow .Value got deleted in the first example:

Range("A1:O1").Value =


In article <jemcgimpsey-(E-Mail Removed)>,
JE McGimpsey <(E-Mail Removed)> wrote:

> One way:
>
> Range("A1:O1") =

 
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
Re: Help-Intellisense (Code Snippet) Tab Tab does not insert code (VS2008) Jeff Johnson Microsoft C# .NET 0 12th Jul 2010 10:37 PM
is there shorter way to code this rodchar Microsoft C# .NET 9 17th Mar 2009 10:36 AM
Shorter Code Sandy Microsoft Excel Programming 2 7th Jul 2007 08:47 PM
Shorter code Stu Microsoft Excel Programming 13 29th Sep 2003 11:27 PM
Re: Shorter code Stu Microsoft Excel Programming 0 28th Sep 2003 07:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:25 AM.