Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA copy and paste data

Hi -

I have a spreadsheet that I am using as a database and a userform that I am using as the entry portal for the data being entered

I am trying to add some VBA to the userform that will copy data in columns A-C, but only from the last row of entered data. The VBA will run when button CommandButton1 is pressed.

Any help gratefully received

Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default VBA copy and paste data

On 07/02/2014 9:29 AM, Paul Mullan wrote:
Hi -

I have a spreadsheet that I am using as a database and a userform that I am using as the entry portal for the data being entered

I am trying to add some VBA to the userform that will copy data in columns A-C, but only from the last row of entered data. The VBA will run when button CommandButton1 is pressed.

Any help gratefully received

Paul

Spreadsheets being used as a database need to be properly structured as
datatables! Userforms being used as dataforms need to be properly
configured to work as a dataform! If you expect reliable performance and
integretyy from your project then 'willy-nilly', unfortunately, just
won't 'cut it'!

Can you post a download link to your project file so we can better
advise you and/or provide a solution? (Please make sure the file
contains some sample data, and a fully explained expectation of how you
want your dataform to work!)

--
-
Garry

Free Usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default VBA copy and paste data

Paul Mullan wrote:

I have a spreadsheet that I am using as a database and a userform that I
am using as the entry portal for the data being entered

I am trying to add some VBA to the userform that will copy data in
columns A-C, but only from the last row of entered data. The VBA will
run when button CommandButton1 is pressed.


This copies (to the clipboard) from the bottom row that has any data in any
of those 3 columns:

workRow = 0
lastRow = Cells.SpecialCells(xlCellTypeLastCell).Row
For L0 = 1 To 3
If Len(Cells(lastRow, L0).Value) < 1 Then
r1 = Cells(lastRow, L0).End(xlUp).Row
Else
r1 = lastRow
End If
If workRow < r1 Then workRow = r1
Next
Range("A" & workRow & ":C" & workRow).Copy

--
- They're brainwashing you, watch out.
- but i'm hungry
- That's what they want you to think.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default VBA copy and paste data

I forgot to mention that Excel has a builtin dataform for exactly the
purpose of your userform! Did you try using that instead?

--
-
Garry

Free Usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
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
How copy none excel data & paste in 2007 without overwriting data Wakefootin Excel Discussion (Misc queries) 2 October 8th 09 12:15 AM
Copy and Paste LAST ROW of data Sam via OfficeKB.com Excel Programming 18 September 10th 07 03:55 PM
Copy and Paste data Michael M Excel Programming 7 November 10th 06 12:29 AM
filted data, copy and paste a col. puts data in wrong row how fix chris_fig New Users to Excel 1 October 16th 06 04:26 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM


All times are GMT +1. The time now is 04:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"