Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Adding values to a range

Is there a shorthand way to do add a set of different values to a range, as shown in this incorrect
code, which would set E4 to "A31", E5 to "Q12" and E6 to "J13"?

Worksheets("Sheet1").Range("E4:E6").Value = {"A31", "Q12", "J13"}


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Adding values to a range

You must separate each range:

Range("E4").value = Range("A31").value
Range("E5").value = Range("Q12").value
Range("E6").value = Range("J13").value

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Jon" wrote:

Is there a shorthand way to do add a set of different values to a range, as shown in this incorrect
code, which would set E4 to "A31", E5 to "Q12" and E6 to "J13"?

Worksheets("Sheet1").Range("E4:E6").Value = {"A31", "Q12", "J13"}



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Adding values to a range

Thanks Michael.

My example was a bit confusing. "A31", "Q12", "J13" is data that goes into cells as values, rather
than cell numbers.



"Michael" wrote in message
...
You must separate each range:

Range("E4").value = Range("A31").value
Range("E5").value = Range("Q12").value
Range("E6").value = Range("J13").value

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Jon" wrote:

Is there a shorthand way to do add a set of different values to a range, as shown in this
incorrect
code, which would set E4 to "A31", E5 to "Q12" and E6 to "J13"?

Worksheets("Sheet1").Range("E4:E6").Value = {"A31", "Q12", "J13"}





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Adding values to a range

Try this:
Range("E4").value = "A31"
Range("E5").value = "Q12"
Range("E6").value = "J13"

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Jon" wrote:

Thanks Michael.

My example was a bit confusing. "A31", "Q12", "J13" is data that goes into cells as values, rather
than cell numbers.



"Michael" wrote in message
...
You must separate each range:

Range("E4").value = Range("A31").value
Range("E5").value = Range("Q12").value
Range("E6").value = Range("J13").value

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Jon" wrote:

Is there a shorthand way to do add a set of different values to a range, as shown in this
incorrect
code, which would set E4 to "A31", E5 to "Q12" and E6 to "J13"?

Worksheets("Sheet1").Range("E4:E6").Value = {"A31", "Q12", "J13"}






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Adding values to a range

Sub setValues()
Dim myValues(2) As Variant
Dim v As Variant

myValues(0) = "A31"
myValues(1) = "Q12"
myValues(2) = "J13"

i = 4
For Each v In myValues
Range("E" & i).Value = v
i = i + 1
Next
End Sub

"Michael" wrote:

Try this:
Range("E4").value = "A31"
Range("E5").value = "Q12"
Range("E6").value = "J13"

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Jon" wrote:

Thanks Michael.

My example was a bit confusing. "A31", "Q12", "J13" is data that goes into cells as values, rather
than cell numbers.



"Michael" wrote in message
...
You must separate each range:

Range("E4").value = Range("A31").value
Range("E5").value = Range("Q12").value
Range("E6").value = Range("J13").value

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Jon" wrote:

Is there a shorthand way to do add a set of different values to a range, as shown in this
incorrect
code, which would set E4 to "A31", E5 to "Q12" and E6 to "J13"?

Worksheets("Sheet1").Range("E4:E6").Value = {"A31", "Q12", "J13"}








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Adding values to a range

Thanks Michael


"Michael" wrote in message
...
Try this:
Range("E4").value = "A31"
Range("E5").value = "Q12"
Range("E6").value = "J13"

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Jon" wrote:

Thanks Michael.

My example was a bit confusing. "A31", "Q12", "J13" is data that goes into cells as values, rather
than cell numbers.



"Michael" wrote in message
...
You must separate each range:

Range("E4").value = Range("A31").value
Range("E5").value = Range("Q12").value
Range("E6").value = Range("J13").value

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Jon" wrote:

Is there a shorthand way to do add a set of different values to a range, as shown in this
incorrect
code, which would set E4 to "A31", E5 to "Q12" and E6 to "J13"?

Worksheets("Sheet1").Range("E4:E6").Value = {"A31", "Q12", "J13"}








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
Adding values for all rows in a range Alvaro Excel Worksheet Functions 7 October 7th 11 02:47 PM
adding values if the same - SUMIF in range of cells? Eisaz Excel Worksheet Functions 4 November 18th 08 05:05 AM
adding range values to array Gary Keramidas Excel Programming 2 March 12th 07 03:59 AM
adding numbers in a specific range of values Tophaw Excel Discussion (Misc queries) 2 December 27th 06 04:04 PM
Adding input box number to range of cells values Jessica Excel Programming 4 March 22nd 06 06:02 PM


All times are GMT +1. The time now is 11:43 PM.

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"