Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Copy Columns A to I Problem

I have code that Die_Another_Day helped me with, but it only copies the Data
in Column A to the worksheet.
I need to have the data in the row, but Columns A to I in each row copied.
I'm SO tired...I just can't figure out what the problem is.
Can someone let me go to sleep by helping me with this?
Here is the code:

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" & Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And .Range("A" _
& cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Copy Sheets("sheet1").Range("A" & nRow) '<< I
suspect this is the line where the problem is!
End If
Next
End With


End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Copy Columns A to I Problem

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" &
Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And _
.Range("A" & cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Resize(, 9).Copy Sheets("sheet1").Range("A" &
nRow)
End If
Next
End With


End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David" wrote in message
...
I have code that Die_Another_Day helped me with, but it only copies the

Data
in Column A to the worksheet.
I need to have the data in the row, but Columns A to I in each row copied.
I'm SO tired...I just can't figure out what the problem is.
Can someone let me go to sleep by helping me with this?
Here is the code:

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" &

Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And

..Range("A" _
& cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Copy Sheets("sheet1").Range("A" & nRow) '<< I
suspect this is the line where the problem is!
End If
Next
End With


End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Copy Columns A to I Problem

Seems I have a NEW GURU on board!
Worked perfect first time! Thank you so much. Now I need to go through it
and understand why I couldnt' make it work. THANK YOU AGAIN!!

"Bob Phillips" wrote:

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" &
Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And _
.Range("A" & cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Resize(, 9).Copy Sheets("sheet1").Range("A" &
nRow)
End If
Next
End With


End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David" wrote in message
...
I have code that Die_Another_Day helped me with, but it only copies the

Data
in Column A to the worksheet.
I need to have the data in the row, but Columns A to I in each row copied.
I'm SO tired...I just can't figure out what the problem is.
Can someone let me go to sleep by helping me with this?
Here is the code:

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" &

Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And

..Range("A" _
& cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Copy Sheets("sheet1").Range("A" & nRow) '<< I
suspect this is the line where the problem is!
End If
Next
End With


End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Copy Columns A to I Problem

Ah, the resize...thanks again...I'll never have to ask THAT question again :)

"Bob Phillips" wrote:

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" &
Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And _
.Range("A" & cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Resize(, 9).Copy Sheets("sheet1").Range("A" &
nRow)
End If
Next
End With


End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David" wrote in message
...
I have code that Die_Another_Day helped me with, but it only copies the

Data
in Column A to the worksheet.
I need to have the data in the row, but Columns A to I in each row copied.
I'm SO tired...I just can't figure out what the problem is.
Can someone let me go to sleep by helping me with this?
Here is the code:

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" &

Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And

..Range("A" _
& cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Copy Sheets("sheet1").Range("A" & nRow) '<< I
suspect this is the line where the problem is!
End If
Next
End With


End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Copy Columns A to I Problem

A very useful property

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David" wrote in message
...
Ah, the resize...thanks again...I'll never have to ask THAT question again

:)

"Bob Phillips" wrote:

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" &
Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And _
.Range("A" & cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Resize(, 9).Copy Sheets("sheet1").Range("A" &
nRow)
End If
Next
End With


End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David" wrote in message
...
I have code that Die_Another_Day helped me with, but it only copies

the
Data
in Column A to the worksheet.
I need to have the data in the row, but Columns A to I in each row

copied.
I'm SO tired...I just can't figure out what the problem is.
Can someone let me go to sleep by helping me with this?
Here is the code:

Sub CopyData()

Dim LRow As Long 'Last Row
Dim nRow As Long 'Next Row to copy to
Dim cnt As Long
'Dim sourceRange As Range


LRow = Sheets("All_Jobs").Range("A" &

Sheets("All_Jobs").Rows.Count).End(xlUp)
With Sheets("All_Jobs")
For cnt = 7 To LRow
If .Range("A" & cnt) = Range("FilterCriteria").Cells(1) And

..Range("A" _
& cnt) <= Range("FilterCriteria").Cells(2) Then
nRow = Sheets("sheet1").Range("A" & _
Sheets("sheet1").Rows.Count).End(xlUp).Offset(1, 0).Row
'Set sourceRange = ActiveCell.EntireRow
'.Range("sourceRange").Copy Sheets("sheet1").Range("A" & nRow)
.Range("A" & cnt).Copy Sheets("sheet1").Range("A" & nRow) '<<

I
suspect this is the line where the problem is!
End If
Next
End With


End Sub








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
Copy Columns jbjtc Setting up and Configuration of Excel 0 July 9th 07 05:00 PM
A visual basic value copy BUG?? - accounting format has copy problem!! [email protected] Excel Programming 3 June 20th 06 04:42 PM
How do I copy columns between worksheets if the columns don't matc Miriam Excel Worksheet Functions 10 June 12th 06 04:29 PM
Copy columns values into separate columns Mike_can Excel Discussion (Misc queries) 7 May 27th 06 12:32 AM
Copy a row from one sheet to another and not all columns copy Peaches[_2_] Excel Programming 2 September 7th 05 12:09 PM


All times are GMT +1. The time now is 08:16 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"