Hi I recentlly posted a thread asking for help with my macros. it got solved but now i'm facing another problem with the sheet naming. I want the data to be copied from worksheet 'Check-In' to worksheet 'Customer Details'.
http://www.excelforum.com/excel-prog...n-one-row.html
I'm trying to create a macro that will copy and then paste a range of cells to another worksheet but in one row. The cells that I would like to copy are in 3 different rows. They are B7:F7, C12:D12, C17:E17. Now I've managed to find a macro through this forum that will paste the particular cells but they I can't seem to find a way to record a macro that will paste them in one row. In addition to that I also tried copying and pasting each of the ranges of cells individually it kind of worked but it came up with an error box.
The problem is, even if I can find a macro to paste those cells it has to be able to paste them underneath the previous row. So e.g it should paste the cells in row 17 and then when i press the command button again it should paste them to row 18.
Thanks loads for reading and for offering to help
Last edited by andria; 01-10-2009 at 11:49 AM.
hi I should've made myself clearer. What I'm trying to say is, in the Visual Basic of the macro, whats written is that the cells should be pasted into Sheet 2. I want them pasted from worksheet 'Sign-In' to 'Customer Details' worksheet. i've tried a number of times but it keeps saying there's a runtime error or something.
thanks for reading
Try this
It copies values only - no cell formatting
Code:Sub CopyData() Dim lNR As Long Dim wsSI As Worksheet Dim wsCD As Worksheet Set wsSI = ThisWorkbook.Worksheets("Sign-In") Set wsCD = ThisWorkbook.Worksheets("Customer Details") lNR = wsCD.Cells(Rows.Count, "a").End(xlUp).Row + 1 wsCD.Range("a" & lNR & ":e" & lNR).Value = wsSI.Range("b7:f7").Value wsCD.Range("f" & lNR & ":g" & lNR).Value = wsSI.Range("c12:d12").Value wsCD.Range("h" & lNR & ":j" & lNR).Value = wsSI.Range("c17:e17").Value Set wsSI = Nothing Set wsCD = Nothing End Sub
Please Read Forum Rules Before Posting
Wrap VBA code by selecting the code and clicking the # icon or Read This
How To Cross Post politely
Top Excel links for beginners to Experts
If you are pleased with a member's answer then use the Scales icon to rate it
If my reply has assistedor failed to assist you
I welcome your Feedback.
absolutely perfect!!!!!!
THANK YOU!!!!!!!![]()
Glad to hear the code solved your problem
Please Read Forum Rules Before Posting
Wrap VBA code by selecting the code and clicking the # icon or Read This
How To Cross Post politely
Top Excel links for beginners to Experts
If you are pleased with a member's answer then use the Scales icon to rate it
If my reply has assistedor failed to assist you
I welcome your Feedback.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks