can someone direct me a code where will i be able to view all the values in a column next after next using a command button where the values will be displayed using a label.
can someone direct me a code where will i be able to view all the values in a column next after next using a command button where the values will be displayed using a label.
Could you explain a bit better or provide a sample.Originally Posted by chase
Originally Posted by dazwm
sorry..
what i mean is...for example..i have a list of records in "sheet2" from range "A1 to A15" then, i want to display those values in "sheet1" using a label control and a command button..in which whenever i press the command button, the label control will display the values listed in "sheet2" ranging from "A1 to A15".
hope you can help me here..
Please note that I used the default CodeName. Try:
[VBA]
Option Explicit
Private Sub CommandButton1_Click()
Dim Cell As Range
Dim sValues As String
For Each Cell In Sheet2.Range("A1:A15")
If Not Cell.Value = vbNullString Then
sValues = sValues & Cell.Value & vbLf
End If
Next
Me.Label1.Caption = Left(sValues, Len(sValues) - 1)
End Sub[/VBA]
Hope that helps,
Mark
ACK!
The above goes in Sheet1's code module and presumes activex controls.
thanks for the help..it is working..but i forgot to mention that i need to display values one by one..so whenever i press the command button each time the display in label will change accordingly to the following values in sheet 2..Originally Posted by GTO
Sorry - not sure I am following. Do you mean that you want the Label to only show one of the cells' value at a time? If so, is each click of the button to get the next cell's value?Originally Posted by chase