Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default Excel User Form Macros

Pagal

It sounds like you need something like this

Dim i as Long
Dim ColNo as Long

For i = 1 to Me.Controls.Count
ColNo = Application.Match(Me.Controls(i).Tag,Pigs.Range("R ow with
fieldnames"),False)
Pigs.Cells(LastRow of datatable, ColNo).Value = Me.Controls.Text
Next i

The Match function determines which column contains the field name, then
rights the text property of that control to that column.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Pagal" wrote in message
om...
Hi,

I am building a user form in Excel. This is brought up on clicking a
button on a form.

In the form, I display data from a data sheet (data table):

Field Name - Name Age Address
Data - ABCD 12 123, ....
Data - EFGH 34 456, ....
Data - IJKL 56 789, ....
Data - MNOP 78 012, ....

using HLOOKUP as
oTextBox.Text = Application.WorksheetFunction.HLookup(oTextBox.Tag ,
Pigs.Range(Pigs.Cells(1, 1), Pigs.Cells(m_iRecordCount + 1,
m_iFieldCount)), m_iCurrentRecord + 1, False)

oTextBox.Tag = Field Name, inorder to avoid writing field-specific
function to populate the UI.

works fine.


Now, I need to insert data into the data sheet (at the end) using the
field name.

What I want to do is - When the users clicks on an 'Insert' button on
the form, I want to go to the last row of the table. Iterate through
the textboxes and using their 'Tag' property to identify the column,
insert its text.

I haven't been able to figure this out yet.

Any pointers on how to do this would be very welcome.

Thanks,
Rajesh



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
Excel User Form MG Excel Worksheet Functions 0 February 25th 09 12:58 AM
Making a Form for User-friendly Macros? SeventFloorProfessor Excel Discussion (Misc queries) 1 January 17th 09 04:37 PM
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
How do I create an user form to run macros in excel? mgj72394 Excel Discussion (Misc queries) 5 April 28th 07 06:40 PM
how to do a web query on an web browser on an user form using macros Sunny via OfficeKB.com Links and Linking in Excel 0 March 28th 06 01:47 PM


All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"