Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data to Sequential Cells

Status
Not open for further replies.

tim216

Civil/Environmental
Aug 27, 2002
38
I am writing a sheet to handle slope staking data and I need to get my information from my user form to the cell. But I need it to perform a loop function so that when I input the next stations values it will insert the data to the next set of cells. Any suggestions would be helpful.

Thanks Tim
 
Replies continue below

Recommended for you

Without knowing too much of what your trying to do, i think a version of vlookup would suffice, this can be found under INsert -> function.

Vlookups are good for picking out a single cell ref i.i a station number, and then in cells you choose on antoher sheet it will fill out data taken from across the original cell.

the only caveat is that the cells that the vlooup is performed on has to be in some type of sequential order, or you have to use the false command at the end of the formula.

 
I do this in Quattro by re-naming the input cell which I have reached. The macro runs the same steps each time but find the named cell when the input comes around. The last step in my "do loop" visits the specific named cell, drops one cell on the sheet and then renames that cell. I'm more familiar with Quattro macros than Excel but I'm sure the same logic will work.
You could also name all the possible input cells ahead of time including a row number and then coordinate that with the macro loop count.
 
I guess what I was asking was how would I write a loop statement into my vba macro so that when I began inputing data for my next station it would automaticaly move to the next cell. I have it to where I input the desired cell before the data is input but that gets a little tedious when I have more than 3 or 4 hundred ft of slope stake data if the vloop can be set to repeat a certain # of times then that would be fine
 
I hope I'm on the right track here, this is a simple loop to find the next empty cell in a row or column. Assumming the data is in column B (2 in macro) and the data will be in rows 10 to 110.

For x = 10 to 110
If IsEmpty(Cells(x,2))then goto exit1
next x
exit1:

you can then use the VB to put the value you require into the next empty cell Cells(x,2)
 
Thanks to all you guys and gals ( just to be safe ) I went back and re sized my sheet. Then I just included a call for each cell in order of use. It made for some long code but I am not using more than 4 cells and maybe 20 rows. I think I am going to try Buffo method to see if it is any easier.

Tim
 
You can also just use a row counter, assuming each loop is in the next row.
Code:
Dim iRow As Long
iRow = 2 'First row for data

start loop...

   Range("A" & iRow) = Text1.Text
   Range("B" & iRow) = Text2.Text
   Range("C" & iRow) = Text3.Text
   iRow = iRow + 1

end loop...
Not sure if that's what you were after... DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor