Solved

Copy Row of Data

Posted on 2013-06-03
3
235 Views
Last Modified: 2013-06-03
I'm trying to figure out a way to copy my row of information to another worksheet in my workbook if there is text in Column A, and a date in Column B. Data will be in Column C to Q. I would like to have it LOOP so when a user clicks a button and the VBA code looks down Column A and Column B to see if there is any data it would then move the row of data in column A to column Q to the last available row of a worksheet called 'Detail'.
TransferData.xls
0
Comment
Question by:Southern_Gentleman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39215566
Pls try

Sub DoIt()

Dim shData As Worksheet
Dim shDetail As Worksheet

Set shData = Worksheets("Data")
Set shDetail = Worksheets("Detail")

On Error Resume Next
For IdxRow = shData.Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
    If WorksheetFunction.IsText(Cells(IdxRow, "A").Value) And IsDate(Cells(IdxRow, "B").Value) Then
        Application.CutCopyMode = False
        shData.Range(Range("A" & IdxRow), Range("Q" & IdxRow)).Cut _
            Destination:=shDetail.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
        shData.Cells(IdxRow, 1).EntireRow.Delete Shift:=xlUp
    End If
Next
End Sub

Open in new window

EDIT Corrected Bug
Regards
0
 

Author Comment

by:Southern_Gentleman
ID: 39216750
Right on. Works great! Gonzo
0
 

Author Closing Comment

by:Southern_Gentleman
ID: 39216752
Awesom
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question