Pending Records

N

Neon520

Hi everyone,

I have a little bit of problem with the code for pending records when
transferring to a different sheet, which can cause a serious problem.

Here is the code:

'Passing Name
Sheets("Sheet2").Range("A65000").End(xlUp).Offset(1, 0).Value = _
Sheets("Form").Range("B3").Value

'Passing Phone #
Sheets("Sheet2").Range("B65000").End(xlUp).Offset(1, 0).Value = _
Sheets("Form").Range("B4").Value

I use the same code different Cell in "Form" to pass the data to different
Column in "Sheet2".
The problem is if Record #1 in "Form" doesn't have Phone # when passing, the
corresponded cell in "Sheet2" will be blank too, which is fine. But Record
#2 in "Form" that has Phone #, the code pass the Phone # for Record #2 to
Record #1 because it finds that the Last blank cell is in Record#1. It
doesn't stay with Record #2 .

I hope I explain myself for this matter. Is there a way to keep every field
to stay with its own record?

Appreciate for any help.

Neon520
 
P

Per Jessen

Hi

Calculate NewRow from colum A and use it in column B

Set sh2 = Sheets("Sheet2")
NewRow = sh2.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row

'Passing Name
sh2.Range("A" & NewRow).Value = Sheets("Form").Range("B3").Value

'Passing Phone #
sh2.Range("B" & NewRow).Value = Sheets("Form").Range("B4").Value

Regards,
Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top