Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Filling values to columns

Hi,
I am quite new to Excel programming so this question might seem basic..
I need to add values to consecutive columns and i want to do this automatically.
For example i have 5 values that i have to enter to column c,d,e,f,g appropriately.
Does anyone know how to do this?
Thanks,
Hilla
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Filling values to columns

Hilla,


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Option Explicit
Sub TEST_1()

Range("C1:G1").Value = Array(1, 2, 3, 4, 5)

End Sub

Sub TEST_2()

Range("C2").Resize(1, 5).Value = Array(10, 20, 30, 40, 50)

End Sub

Sub TEST_3()

Dim RNG As Range
Dim N As Integer

Set RNG = Range("C3")
N = 5
RNG.Resize(1, N).Value = Array(100, 200, 300, 400, 500)

End Sub

Sub TEST_4()

Dim RNG As Range
Set RNG = Range("C4")

RNG.Resize(1, 5).Value = Array([A1], [B1], [A3], [B4], [A5])

End Sub


Sub TEST_5()

Dim i As Integer
Dim X As Variant

X = Array("A8", "A9", "B8", "B9", "B10")

For i = 1 To 5
Range("C5")(1, i).Value = Range(X(i - 1)).Value
Next

End Sub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


--
Regards,
Soo Cheon Jheong
_ _
^ąŻ^
--



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Filling values to columns

Hilla

There is a myriad of ways you could do this but you question is not full of
detail of what values, is it repeating, etc. Below will do what you ask but
suspect it is not a solution that will work for you

Sub fillRange()
Range("C1:G1").Value = Array(1, 2, 3, 4, 5)
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Hilla" wrote in message
m...
Hi,
I am quite new to Excel programming so this question might seem basic..
I need to add values to consecutive columns and i want to do this
automatically.
For example i have 5 values that i have to enter to column c,d,e,f,g
appropriately.
Does anyone know how to do this?
Thanks,
Hilla



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Filling values to columns

Thanks Alot!!
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
Filling In A Column With Incrementing Values ? Bob[_19_] New Users to Excel 2 March 15th 10 03:38 PM
Filling values in a grid Cecilia Excel Worksheet Functions 4 November 1st 06 10:53 AM
Add new Worksheet after filling first 256 columns m4nd4li4 Excel Programming 7 March 7th 04 07:58 AM
Filling a cell with values from another worksheet Jatherton Excel Programming 1 January 9th 04 09:12 PM
Filling a ComoboBox with Values on a different Worksheet Dave Baranas Excel Programming 1 August 12th 03 09:59 PM


All times are GMT +1. The time now is 09:35 PM.

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"