Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Having problems with adding input from combobox

Ok, been working on this one, and my last thread went dead, so gonna tr
again (trying to get this working tonight so I can finish thi
project)

Here's the code so far

If cbName.ListIndex < 0 Then
MsgBox cbName & " not on list, adding now"
Set Rng = Worksheets("Master").Range("A3").End(xlDown)(2)
Set rng1 = Worksheets("Light Class").Range("A1").End(xlToRight)(1, 2)
rng1 = cbName
rng1.Offset(1, 0) = CDbl(tbScore)
Rng = cbName
Rng.Offset(0, 1) = "=AVERAGE('Light Class'!" & rng1.Offset(1
0).Resize(799).Address & ")"
Rng.Offset(0, 2) = "=SUM('Light Class'!" & rng1.Offset(1
0).Resize(799).Address & ")"
Rng.Offset(0, 3) = "=COUNT('Light Class'!" & rng1.Offset(1
0).Resize(799).Address & ")"
MsgBox Format(Rng) & " Added"
Exit Sub
End If


This works just about 100% .. takes cbName (the combobox input) an
places it to the first empty row in column A on the Master sheet, the
places it in the first empty column on row 1 for the Light Clas
sheet.

The problem I have is this only works if there are at least 2 cell
filled .. I need this to work even if there are no cells input(startin
with A3 and going down on Master sheet and starting at A1 and goin
right on the Light Class sheet)

Any Ideas?

Thanks in Advance..
Stev

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Having problems with adding input from combobox

Steve,

Change

Set Rng = Worksheets("Master").Range("A3").End(xlDown)(2)
to
Set Rng = Worksheets("Master").Range("A65536").End(xlUp)(2)

You might also consider changing
Set rng1 = Worksheets("Light Class").Range("A1").End(xlToRight)(1, 2)
to
Set rng1 = Worksheets("Light Class").Range("IV1").End(xlToLeft)(1, 2)

HTH,
Bernie
MS Excel MVP


"stevem " wrote in message
...
Ok, been working on this one, and my last thread went dead, so gonna try
again (trying to get this working tonight so I can finish this
project)

Here's the code so far

If cbName.ListIndex < 0 Then
MsgBox cbName & " not on list, adding now"
Set Rng = Worksheets("Master").Range("A3").End(xlDown)(2)
Set rng1 = Worksheets("Light Class").Range("A1").End(xlToRight)(1, 2)
rng1 = cbName
rng1.Offset(1, 0) = CDbl(tbScore)
Rng = cbName
Rng.Offset(0, 1) = "=AVERAGE('Light Class'!" & rng1.Offset(1,
0).Resize(799).Address & ")"
Rng.Offset(0, 2) = "=SUM('Light Class'!" & rng1.Offset(1,
0).Resize(799).Address & ")"
Rng.Offset(0, 3) = "=COUNT('Light Class'!" & rng1.Offset(1,
0).Resize(799).Address & ")"
MsgBox Format(Rng) & " Added"
Exit Sub
End If


This works just about 100% .. takes cbName (the combobox input) and
places it to the first empty row in column A on the Master sheet, then
places it in the first empty column on row 1 for the Light Class
sheet.

The problem I have is this only works if there are at least 2 cells
filled .. I need this to work even if there are no cells input(starting
with A3 and going down on Master sheet and starting at A1 and going
right on the Light Class sheet)

Any Ideas?

Thanks in Advance..
Steve


---
Message posted from http://www.ExcelForum.com/



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
Variable length of input area in a combobox Kasper Excel Discussion (Misc queries) 1 July 24th 09 01:15 PM
Horizontal Input for Combobox krais Excel Discussion (Misc queries) 2 July 5th 06 07:37 PM
Compare input from ComboBox stevem[_4_] Excel Programming 0 April 1st 04 07:42 PM
Combobox Visibility Problems anthonyvassallo Excel Programming 1 November 7th 03 03:30 PM
ComboBox Problems Darrin Henry Excel Programming 1 September 16th 03 01:23 AM


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