Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Other ways. I prefer Main2.
Option Explicit Public rng As Range Public Index As Integer Sub Main() 'refers to the last cell of row Index of rng Index = 4 Set rng = Worksheets("Sheet1").Range("A1:D100") With rng.Rows(Index) .Cells(.Cells.Count) = ComboBox.Value End With End Sub Sub Main2() 'refers to cell Index in the last column of rng Index = 6 Set rng = Worksheets("Sheet1").Range("A1:D100") With rng.Columns(rng.Columns.Count) .Cells(Index) = ComboBox.Value End With End Sub (I used rng for the range, because it seems more "natural" to me and less confusing than using Row for a collection of rows. A range has rows.) -- Bob Kilmer "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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing Variable to LINEST | Excel Worksheet Functions | |||
Newbie stuck on Passing a Variable into a Range | Excel Programming | |||
Passing a variable to a range statement | Excel Programming | |||
UserForm not passing Boolean variable | Excel Programming | |||
Passing a value to a variable from Userform | Excel Programming |