Computing.Net > Forums > Programming > Vba Problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Vba Problem

Reply to Message Icon

Name: The Fayth
Date: January 12, 2004 at 13:21:50 Pacific
OS: Windows XP
CPU/Ram: 2.66Ghz / 512Mb
Comment:

Hi
Does someone know how to when in VBA, when typing into a user input form, you then press the relevant command button on the form, say 'update' and then that information just entered into teh form will ome up on a row in an excel spreadsheet and then the problem is that how do you code it so that when the data, you've just entered goes into the top row, how will you you go about going straight onto the second row and so forth.

I got this bit of code, but is thee a bit more that goes with it:

ActiveCell.Offset(1, 0).Select

Thanks




Sponsored Link
Ads by Google

Response Number 1
Name: egkenny
Date: January 12, 2004 at 20:53:12 Pacific
Reply:

There are many ways to do this.
You first have to initialize the first cell
The following works but can be broken
if one clicks on a cell making the
active cell move to that point.
------------------------
Public INIT As Boolean
'
Private Sub UpdateButton_Click()
If INIT = False Then
Range("A1").Select
INIT = True
End If
ActiveCell.Value = TextBox1.Text
RowOffset = 1
ColumnOffset = 0
ActiveCell.Offset(RowOffset, ColumnOffset).Activate
End Sub
=============================================
Another way to do this that can't be
broken by activating another cell is
--------
Public INIT As Boolean
Public Row As Integer
'
Private Sub UpdateButton_Click()
If INIT = False Then
Row = 1
INIT = True
End If
Column = 1
Cells(Row, Column).Value = TextBox1.Text
Row = Row + 1
End Sub


0

Response Number 2
Name: The Fayth
Date: January 13, 2004 at 01:28:45 Pacific
Reply:

Thanks for the help, its actually working now.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Vba Problem

word 2000 vba problem www.computing.net/answers/programming/word-2000-vba-problem/4204.html

Excel VBA Problem saving file www.computing.net/answers/programming/excel-vba-problem-saving-file-/14722.html

Excel-VBA problem www.computing.net/answers/programming/excelvba-problem/3695.html