If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > export date from text box to the right sheet

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-24-08, 04:57
madona33 madona33 is offline
Registered User
 
Join Date: Oct 2008
Posts: 4
Question export date from text box to the right sheet

Hi everyone,

I need your help . I've created an excel document with 3 sheets, a user form with 3 check boxes and 3 text boxes (this document should be like a data bank). I would like to have it like following:

when I check the first check box the right sheet should be activated (I've got this working). Now I want that the data I want to export should go to the right sheet (activated one )and to the right column in the next empty row (line). Every sheet (3 sheets) has 9 columns and 300 rows ( I know how to export the data from textbox to the sheet but I don't know how to send it to the next empty column/row)
The first column is the number of the row and I would like it to update itself to the next no when I enter the data ( if the last no is 10 then the date should be exported to line 11 and the column no should be 11 automatically).

Could anybody help please

Thanks a lot

Madona
Reply With Quote
  #2 (permalink)  
Old 10-24-08, 05:20
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
You need to write a sub that sets the focus on the required sheet, then loops through all the cells in column A until it finds one that's empty. Then it transfers the text over.
Reply With Quote
  #3 (permalink)  
Old 10-24-08, 07:14
madona33 madona33 is offline
Registered User
 
Join Date: Oct 2008
Posts: 4
Hi Weejas,

Thanks for the quick answer. Could you or anybody help with a VBA Code for that please?

Thanks a lot

Madona
Reply With Quote
  #4 (permalink)  
Old 10-24-08, 07:30
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
Zip a copy of the spreadsheet and upload it - I'll see what I can do.
Reply With Quote
  #5 (permalink)  
Old 10-24-08, 09:17
madona33 madona33 is offline
Registered User
 
Join Date: Oct 2008
Posts: 4
Thanks a lot Weejas,

File is attached
Attached Files
File Type: zip wireless3.zip (23.0 KB, 29 views)
Reply With Quote
  #6 (permalink)  
Old 10-24-08, 11:05
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
Talking

Here you go

A couple of pointers - name your controls! It's much easier to move data around if you know what each item is. Also, comments are your friends. One programmer might have been of the opinion that "It was hard to write - it should be hard to understand!" but I disagree. Believe me, you put this down for a couple of weeks and go back to it, and you'll spend the first hour just trying to work out what everything does.

Lecture over.

I've commented out your original code and renamed all the controls. I've also got rid of the frame, and replaced the check boxes with option buttons in named groups. I've also commented out the line of code that close the application after setting the saved status to True - this caused a (brief) loss of data when I clicked "No" by accident. You probably want to revisit this, unless this functionality works in conjunction with something else.

The form now uses the value in grpType (saved in a global variable as a number) to derive the name of the required sheet. It uses the value in grpReason to determine which Reason column requires populating. It then finds the next vacant cell in column A below row four, and generates the next number (either 1 if the cell above is not numeric, or the value of the cell above plus 1). Finally it dumps the contents of the text boxes into the relevant cells in that row. It foes not change the focus in order to do this - it happens invisibly (unless the target area is visible). Enjoy!
Attached Files
File Type: zip wireless3.zip (28.1 KB, 42 views)
Reply With Quote
  #7 (permalink)  
Old 10-24-08, 16:43
madona33 madona33 is offline
Registered User
 
Join Date: Oct 2008
Posts: 4
THANK YOU, THANK YOU,THANK YOU, THANK YOU,THANK YOU, THANK YOU,THANK YOU, THANK YOU,.............................................. .................................................. ......................
.............................YOU ARE A STAAAAAAAR.

madona
Reply With Quote
  #8 (permalink)  
Old 10-24-08, 16:55
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
You're welcome.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On