Solved

Copy Row of Data

Posted on 2013-06-03
3
200 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
  • 2
3 Comments
 
LVL 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now