Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jon Jon is offline
external usenet poster
 
Posts: 183
Default how to transfer data from sheet to sheet with new range?

Greeting
I have a work book with two sheets. Sheet 1 is for entering data with range
from a1to d1. in sheet 2, I need the range in sheet 1 to be transferred to
a1:d1. What I want to do is when entering data in sheet 1, the data transfer
to sheet 2 and if there is a data in the above rang, a new range is setting
for the new data.
thanks

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default how to transfer data from sheet to sheet with new range?

Sub xfr_data()
Dim r As Range
Set r1 = Sheets("Sheet1").Range("A1:D1")
For i = 1 To Rows.Count
n = Application.WorksheetFunction.CountA(Range(Cells(i , 1), Cells(i, 4)))
If n = 0 Then
Set r2 = Sheets("Sheet2").Cells(i, 1)
r1.Copy r2
Exit Sub
End If
Next
End Sub

Run the macro after you have entered data in Sheet1
--
Gary''s Student - gsnu200738


"Jon" wrote:

Greeting
I have a work book with two sheets. Sheet 1 is for entering data with range
from a1to d1. in sheet 2, I need the range in sheet 1 to be transferred to
a1:d1. What I want to do is when entering data in sheet 1, the data transfer
to sheet 2 and if there is a data in the above rang, a new range is setting
for the new data.
thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
Jon Jon is offline
external usenet poster
 
Posts: 183
Default how to transfer data from sheet to sheet with new range?

hi,
there is an error"error 9
subscript out of range"
Please advice?


"Gary''s Student" wrote:

Sub xfr_data()
Dim r As Range
Set r1 = Sheets("Sheet1").Range("A1:D1")
For i = 1 To Rows.Count
n = Application.WorksheetFunction.CountA(Range(Cells(i , 1), Cells(i, 4)))
If n = 0 Then
Set r2 = Sheets("Sheet2").Cells(i, 1)
r1.Copy r2
Exit Sub
End If
Next
End Sub

Run the macro after you have entered data in Sheet1
--
Gary''s Student - gsnu200738


"Jon" wrote:

Greeting
I have a work book with two sheets. Sheet 1 is for entering data with range
from a1to d1. in sheet 2, I need the range in sheet 1 to be transferred to
a1:d1. What I want to do is when entering data in sheet 1, the data transfer
to sheet 2 and if there is a data in the above rang, a new range is setting
for the new data.
thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default how to transfer data from sheet to sheet with new range?

Most likely, the spelling of the worksheet names. This code assumed:

Sheet1
Sheet2

If your tab names are different, just change the code to match the names.
--
Gary''s Student - gsnu200738


"Jon" wrote:

hi,
there is an error"error 9
subscript out of range"
Please advice?


"Gary''s Student" wrote:

Sub xfr_data()
Dim r As Range
Set r1 = Sheets("Sheet1").Range("A1:D1")
For i = 1 To Rows.Count
n = Application.WorksheetFunction.CountA(Range(Cells(i , 1), Cells(i, 4)))
If n = 0 Then
Set r2 = Sheets("Sheet2").Cells(i, 1)
r1.Copy r2
Exit Sub
End If
Next
End Sub

Run the macro after you have entered data in Sheet1
--
Gary''s Student - gsnu200738


"Jon" wrote:

Greeting
I have a work book with two sheets. Sheet 1 is for entering data with range
from a1to d1. in sheet 2, I need the range in sheet 1 to be transferred to
a1:d1. What I want to do is when entering data in sheet 1, the data transfer
to sheet 2 and if there is a data in the above rang, a new range is setting
for the new data.
thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
Jon Jon is offline
external usenet poster
 
Posts: 183
Default how to transfer data from sheet to sheet with new range?

Hi
Thanks a lot, the problem disappeared, and the new problem is there is no
data in sheet2


"Gary''s Student" wrote:

Most likely, the spelling of the worksheet names. This code assumed:

Sheet1
Sheet2

If your tab names are different, just change the code to match the names.
--
Gary''s Student - gsnu200738


"Jon" wrote:

hi,
there is an error"error 9
subscript out of range"
Please advice?


"Gary''s Student" wrote:

Sub xfr_data()
Dim r As Range
Set r1 = Sheets("Sheet1").Range("A1:D1")
For i = 1 To Rows.Count
n = Application.WorksheetFunction.CountA(Range(Cells(i , 1), Cells(i, 4)))
If n = 0 Then
Set r2 = Sheets("Sheet2").Cells(i, 1)
r1.Copy r2
Exit Sub
End If
Next
End Sub

Run the macro after you have entered data in Sheet1
--
Gary''s Student - gsnu200738


"Jon" wrote:

Greeting
I have a work book with two sheets. Sheet 1 is for entering data with range
from a1to d1. in sheet 2, I need the range in sheet 1 to be transferred to
a1:d1. What I want to do is when entering data in sheet 1, the data transfer
to sheet 2 and if there is a data in the above rang, a new range is setting
for the new data.
thanks



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default how to transfer data from sheet to sheet with new range?

FIRST put data in Sheet1 the first row cells A1 thru D1.
THEN run the macro.
--
Gary''s Student - gsnu200738


"Jon" wrote:

Hi
Thanks a lot, the problem disappeared, and the new problem is there is no
data in sheet2


"Gary''s Student" wrote:

Most likely, the spelling of the worksheet names. This code assumed:

Sheet1
Sheet2

If your tab names are different, just change the code to match the names.
--
Gary''s Student - gsnu200738


"Jon" wrote:

hi,
there is an error"error 9
subscript out of range"
Please advice?


"Gary''s Student" wrote:

Sub xfr_data()
Dim r As Range
Set r1 = Sheets("Sheet1").Range("A1:D1")
For i = 1 To Rows.Count
n = Application.WorksheetFunction.CountA(Range(Cells(i , 1), Cells(i, 4)))
If n = 0 Then
Set r2 = Sheets("Sheet2").Cells(i, 1)
r1.Copy r2
Exit Sub
End If
Next
End Sub

Run the macro after you have entered data in Sheet1
--
Gary''s Student - gsnu200738


"Jon" wrote:

Greeting
I have a work book with two sheets. Sheet 1 is for entering data with range
from a1to d1. in sheet 2, I need the range in sheet 1 to be transferred to
a1:d1. What I want to do is when entering data in sheet 1, the data transfer
to sheet 2 and if there is a data in the above rang, a new range is setting
for the new data.
thanks

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default how to transfer data from sheet to sheet with new range?

This is a little more precise:

Sub xfr_data()
Dim r As Range
Set r1 = Sheets("Sheet1").Range("A1:D1")
Sheets("Sheet2").Activate
For i = 1 To Rows.Count
n = Application.WorksheetFunction.CountA(Range(Cells(i , 1), Cells(i, 4)))
If n = 0 Then
Set r2 = Sheets("Sheet2").Cells(i, 1)
r1.Copy r2
Exit Sub
End If
Next
End Sub


--
Gary''s Student - gsnu200738


"Jon" wrote:

Hi
Thanks a lot, the problem disappeared, and the new problem is there is no
data in sheet2


"Gary''s Student" wrote:

Most likely, the spelling of the worksheet names. This code assumed:

Sheet1
Sheet2

If your tab names are different, just change the code to match the names.
--
Gary''s Student - gsnu200738


"Jon" wrote:

hi,
there is an error"error 9
subscript out of range"
Please advice?


"Gary''s Student" wrote:

Sub xfr_data()
Dim r As Range
Set r1 = Sheets("Sheet1").Range("A1:D1")
For i = 1 To Rows.Count
n = Application.WorksheetFunction.CountA(Range(Cells(i , 1), Cells(i, 4)))
If n = 0 Then
Set r2 = Sheets("Sheet2").Cells(i, 1)
r1.Copy r2
Exit Sub
End If
Next
End Sub

Run the macro after you have entered data in Sheet1
--
Gary''s Student - gsnu200738


"Jon" wrote:

Greeting
I have a work book with two sheets. Sheet 1 is for entering data with range
from a1to d1. in sheet 2, I need the range in sheet 1 to be transferred to
a1:d1. What I want to do is when entering data in sheet 1, the data transfer
to sheet 2 and if there is a data in the above rang, a new range is setting
for the new data.
thanks

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 to transfer text to an sheet if the cells en range contains a mia_kit Excel Discussion (Misc queries) 2 May 24th 07 04:40 PM
How to Automatically transfer specific Data from Sheet 1 to Sheet Jman Excel Worksheet Functions 12 May 10th 07 05:35 AM
How do I transfer data from 1 sheet to another? Syd Excel Worksheet Functions 2 June 7th 06 05:45 PM
Transfer data from one sheet to another Cody Excel Discussion (Misc queries) 1 November 28th 05 02:36 AM
Transfer data from sheet to sheet Jenn Excel Discussion (Misc queries) 4 January 20th 05 03:07 PM


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