Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Application.GoTo.Reference query

Hi Brian

I'm not sure if this will be of any help to you but i thought it worth
a mention. what i do in a situation like yours is load all the
information into the combobox and hide all but the first column of
info then move the information using the combobox change event, this
means i don't have to write a ton of code for each case of a select
case statement. i have enclosed some example code below for you to
have a wee look over.

To test put some values in the range "A1:T23" then add a combobox to a
userform and paste the code below in the userform code module.

Option Explicit
Dim i As Integer
Dim NewRow As Range

Private Sub ComboBox1_Change()
'Activate the sheet you wish to move the data to
Worksheets("Report").Activate
'Set the "i" variable
i = 0
'Set "NewRow" variable to the next empty row in sheet
Set NewRow = [A65535].End(xlUp).Offset(1, 0)
'Set a loop
Do Until i = 20
'Put the value from the combobox to the cell
NewRow.Value = ComboBox1.List(ComboBox1.ListIndex, i)
'Iterate 1 cell to the right for the next pass
Set NewRow = NewRow.Offset(0, 1)
'Iterate "i" variable for the next pass
i = i + 1

Loop
'Set your active sheet to the data sheet
Worksheets("Data").Activate

End Sub

Private Sub UserForm_Initialize()
'Activate the sheet that holds your data
Worksheets("Data").Activate
'Load that data into your combobox
With ComboBox1
'Set the Number of columns you need
..ColumnCount = 20
'Pass the range of data to the combobox
..RowSource = "A1:T23"
'Hide all the columns other than the first one
..ColumnWidths = "100;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0"

End With

End Sub

hope this helps you out

S

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
Application.Goto Reference gets error 1004 cellist Excel Discussion (Misc queries) 4 December 25th 08 09:32 PM
Application.Goto Reference:="ActiveCell.Value"??? Whats wrong?? [email protected] Excel Programming 13 July 12th 06 11:47 AM
Application.Goto reference:="MyCell" akyhne[_2_] Excel Programming 1 August 16th 05 12:30 PM
Application.GoTo Ashman Excel Programming 2 January 8th 05 04:19 PM
'Application.Goto Reference Tom Ogilvy Excel Programming 0 February 24th 04 06:15 PM


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