LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Identify Last Row

Greetings,

I have two sheets. One to check, verify or make new record with the
entries. The second is to store the data.

To verify is simply to look at each record until a mistake or omission
is discovered, then I must decide if a correction of this record is
required or a new record with slightly different data needs to be
made.

For a correction, I use the link from a Forms ComboBox, which gives me
the row number to modify.

For a new record to be made, from this record I just modified,
requires that I first make a copy of the last row in the data list,
copy it to the row just below the last row and then copy the data,
from the form that I modified, into this new last row, one cell at a
time.

I tried this sub to choose and copy to the correct row. Only the
modified chosen row works (because of the value in the ComboBox linked
cell):

Private Sub bCompleteRecordEdit_Click()
Dim lRowToEdit As Long
Dim lLastRow As Long

Set wb1 = ThisWorkbook
Set ws1 = wb1.Worksheets("CustList")
If MsgBox("Do want to modify this record or create a new record?
Click Yes to modify or No to create a new record.", vbYesNo, "What do
you want to do with this record?") = vbYes Then
lRowToEdit = Range("pfDisc").Value '<<<This choice works
Else
ws1.Activate 'This is the destination sheet

'<This is where debug kicked me out with
'Copy method of range class failed
ws1.Range("A65536").End(xlUp).Copy _
Destination:=Range("A65536").End(xlUp) + 1 '<<<

Application.CutCopyMode = False
lRowToEdit = Range("A65536").End(xlUp) + 1
End If

'PasteDown1 takes an argument which is
'the row that PasteDown1 is to work with.
PasteDown1 lRowToEdit
End Sub

Here is the PasteDown1 Sub:

Sub PasteDown1(lRowToModify As Long)
Set wb1 = ThisWorkbook
Set ws1 = wb1.Worksheets("CustList")
Set ws2 = wb1.Worksheets("Print_Form")
With ws1.Range("A" & lRowToModify + 1)
For i = 4 To 79
.Offset(0, i).Value = _
ws2.Range("pfCell_" & i).Value
Next i
End With
End Sub

I think I need a different way to identify the last row.

Any ideas or pointers will be greatly appreciated.

-Minitman
 
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
Identify and add formula - can it be done? KP Excel Worksheet Functions 4 August 7th 06 08:02 PM
Identify a hyperlink shantanu oak Excel Discussion (Misc queries) 0 August 4th 06 02:01 PM
how to identify sarans Excel Worksheet Functions 7 October 26th 05 09:15 PM
identify duplicates 5thsun7thchild Excel Discussion (Misc queries) 1 September 1st 05 04:06 PM
Trying to identify what is not there Robert[_14_] Excel Programming 2 October 9th 04 11:10 AM


All times are GMT +1. The time now is 03:56 PM.

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"