Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inputting data to next blank cell

My basic code for inputting data into 4 columns is below. The data is in 3
text documents (am249_1, am249_2, am249_3). This works.

I need some code which will move down to the next blank cell in a column and
insert the next data file after any data already present in the column. I
need it so the data files can be opened in any order and that it will detect
if data is already open.

'Inputbox asking for filename
Dim Name
Name = InputBox("Please enter the filename you would like to open:", , , 100)
'Opening files
If Name = "am249_1" Then
Open "C:\Documents and Settings\MC\Desktop\VBA assignment\am249_1.txt" For
Input As #1
Linect = ActiveCell
Do Until EOF(1)
Input #1, t1, t2, t3, t4
Range("A1").Offset(Linect, 0) = t1
Range("B1").Offset(Linect, 0) = t2
Range("C1").Offset(Linect, 0) = t3
Range("D1").Offset(Linect, 0) = t4
Linect = Linect + 1
Loop
Close #1
End If
If Name = "am249_2" Then
Open "C:\Documents and Settings\MC\Desktop\VBA assignment\am249_2.txt" For
Input As #2
Linect = 0
Do Until EOF(2)
Input #2, t1, t2, t3, t4
Range("A1").Offset(Linect, 0) = t1
Range("B1").Offset(Linect, 0) = t2
Range("C1").Offset(Linect, 0) = t3
Range("D1").Offset(Linect, 0) = t4
Linect = Linect + 1
Loop
Close #2
End If
If Name = "am249_3" Then
Open "C:\Documents and Settings\MC\Desktop\VBA assignment\am249_3.txt" For
Input As #3
Linect = 0
Do Until EOF(3)
Input #3, t1, t2, t3, t4
Range("A1").Offset(Linect, 0) = t1
Range("B1").Offset(Linect, 0) = t2
Range("C1").Offset(Linect, 0) = t3
Range("D1").Offset(Linect, 0) = t4
Linect = Linect + 1
Loop
Close #3
End If


Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inputting data to next blank cell


not sure I understand what you are needing exactly, but for entry into
the empty cell at the end of a column, i like to use:

Dim lRow as integer

lRow = Activesheet.Cells(Rows.Count, 1).End(xlUp).Row

Activesheet.cells(lRow + 1, 1).value = "blah"

Don't know if that helps, but it's a routine I use rather religously in
all manner of tasks ~


--
Ouka
------------------------------------------------------------------------
Ouka's Profile: http://www.excelforum.com/member.php...o&userid=23988
View this thread: http://www.excelforum.com/showthread...hreadid=502603

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
When inputting data in a cell, 20 becomes .20. How do I change? DAC Setting up and Configuration of Excel 1 January 21st 10 07:05 PM
inputting data Shanor Excel Discussion (Misc queries) 0 June 15th 06 10:50 AM
Update a chart immediately after inputting data into data source MELMEL Charts and Charting in Excel 1 December 1st 05 09:34 PM
Inputting Source Data - help please foredis Charts and Charting in Excel 1 June 22nd 05 02:36 PM
Format chart axis by inputting data in a cell Mike Charts and Charting in Excel 1 May 30th 05 03:52 PM


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