Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Newbie stuck on Passing a Variable into a Range

Just another option if your Range is one column wide.

Sub Demo()
Dim Index As Long
Index = 6

[Sheet1!A1:A100].Item(Index) = "ComboBox.Value"
' or
Worksheets("Sheet1").Range("A1:A100")(Index) = "ComboBox.Value"
End Sub

If you are working with a Row (r) and Column (c) offset, maybe something
like this...

Sub Demo2()
Dim r As Long
Dim c As Long
r = 6
c = 3

[Sheet1!A1:A100].Item(r, c) = "ComboBox.Value"
'or
Worksheets("Sheet1").Range("A1:A100")(r, c) = "ComboBox.Value"
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Dave Baranas" wrote in message
...
I am stuck on how to do the following:

I made a 2 variables in a module

Public Row as Range
Public Index as Integer

On my worksheet I wrote

Set Row = Worksheets("Sheet1").Range (A1:A100) ' This is the range of
cells where I want to write to

Then depending on where I want to write to I use this line to put the
value of a combobox into the desired Row on by setting a Index to a
value based on a bunch of IF statements before hand

Worksheets(Sheet1).Range("Row(Index)") = Combobox.Value

All I want to do is put some text into a certain Row I defined as the
range "Row"

And select the right index of the range so the text gets to the right
row in the collumn

I have downloaded the entire newsgroup into my hardrive so I could
search for keywords but no luck. I am sure this question is so easy
nobody has asked it. But I am stuck and any help would be appreciated

Regards,

Dave Baranas






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Newbie stuck on Passing a Variable into a Range

And now my 2 cents -

recommend not using Row and Index for the name of variables as they are
words used by Excel for other stuff.
Range("A1").Row
worksheet function Index

Have found Excel to crash when doing this type of thing.

steve

"Dana DeLouis" wrote in message
...
Just another option if your Range is one column wide.

Sub Demo()
Dim Index As Long
Index = 6

[Sheet1!A1:A100].Item(Index) = "ComboBox.Value"
' or
Worksheets("Sheet1").Range("A1:A100")(Index) = "ComboBox.Value"
End Sub

If you are working with a Row (r) and Column (c) offset, maybe something
like this...

Sub Demo2()
Dim r As Long
Dim c As Long
r = 6
c = 3

[Sheet1!A1:A100].Item(r, c) = "ComboBox.Value"
'or
Worksheets("Sheet1").Range("A1:A100")(r, c) = "ComboBox.Value"
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Dave Baranas" wrote in message
...
I am stuck on how to do the following:

I made a 2 variables in a module

Public Row as Range
Public Index as Integer

On my worksheet I wrote

Set Row = Worksheets("Sheet1").Range (A1:A100) ' This is the range of
cells where I want to write to

Then depending on where I want to write to I use this line to put the
value of a combobox into the desired Row on by setting a Index to a
value based on a bunch of IF statements before hand

Worksheets(Sheet1).Range("Row(Index)") = Combobox.Value

All I want to do is put some text into a certain Row I defined as the
range "Row"

And select the right index of the range so the text gets to the right
row in the collumn

I have downloaded the entire newsgroup into my hardrive so I could
search for keywords but no luck. I am sure this question is so easy
nobody has asked it. But I am stuck and any help would be appreciated

Regards,

Dave Baranas








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
Newbie stuck on Passing a Variable into a Range Dave Baranas Excel Programming 0 August 13th 03 07:54 AM
Newbie stuck on Passing a Variable into a Range Bob Kilmer Excel Programming 0 August 13th 03 02:38 AM
Newbie stuck on Passing a Variable into a Range Bob Kilmer Excel Programming 0 August 13th 03 02:20 AM
Passing a variable to a range statement Mervyn Thomas[_3_] Excel Programming 3 July 25th 03 02:40 PM
Passing a value to a variable from Userform Neal Steiner Excel Programming 1 July 18th 03 09:12 PM


All times are GMT +1. The time now is 06:42 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"