ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   goto next line (https://www.excelbanter.com/excel-programming/417192-re-goto-next-line.html)

Dave Peterson

goto next line
 
dim DataWks as worksheet
dim res as variant 'could be an error
dim myKey as string
dim NextRow as long

set datawks = worksheets("Data")
mykey = "idnumbergoesheresomehow"

with datawks
'key is in column A of
res = application.match(mykey,.range("a:a"),0)
if iserror(res) then
'key not in column A of data worksheet
nextrow = .cells(.rows.count,"A").end(xlup).row + 1
'plop the values in
.cells(nextrow,"A").value = mykey
.cells(nextrow,"B").value = "somethingelse"
....
else
'key is in column A and is in row # res
end if



Miree wrote:

I am new to macros and the like.

I have a pretty input sheet for people to put data in, I need to export it
in to another work sheet(i know to do this) but the form gets cleared and
more data added. I need the data to be entered into the next blank line,
this i dont know how to do. The data also has an identifier number I need
there to be a check that the number doesnt already exist in the stored data,
if it is i need the option to overwrite data or give to it the next number in
the series new numer.

I would like an explination of the code if possible, rather than a cut and
paste job.

Thank you


--

Dave Peterson


All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com