Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Retreiving Sheet1 Data Autometically Uploaded in Sheet2

Hi,

I have a Querry regarding Macros.

I have Two Sheets
In Sheet 1 i have Three Columns

A1. Item Name
B1. Item Qty
C1. Item Price

In Sheet 2 i have 4 Columns

A1. Item Name
B1. Item Qty
C1. Item Price
D1. Calculations

Now i want that as soon as the user enters the Data in Sheet1 it
should autometically gets uploads in the Sheet2.

Right Now i am using the following Formula in Sheet2.
=TRIM('Sheet1'!A1)
=TRIM('Sheet1'!B1)
=TRIM('Sheet1'!C1)

I try the below mentioned code sugested by Nopik on 8th March 2007,
but its not working properly.

Can anyone help me in this regards

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column < 5 Then 'Assume, that you have 4 columns from A to D
Range(Worksheets("Sheet1").Range("A" & Format(Target.Row) & ":C" &
Format(Target.Row))).Copy Worksheets("Sheet2").Range("A" &
Format(Target.Row) & ":C" & Format(Target.Row)) 'You can use "A:C"
Range or, walk thru all .Areas
Range(Worksheets("Sheet2").Range("D" & Format(Target.Row))).Copy
Worksheets("Sheet1").Range("D" & Format(Target.Row)) 'If you want to
return your calculations in Column D. Use "D:D" again to avoid .Areas
processing
End If
End Sub

Thanks

Akash

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Retreiving Sheet1 Data Autometically Uploaded in Sheet2

Hi Akash

You can try this code it should hopefully work for you. open VBE or
press Alt and F11 then in the project explorer pane double click sheet
1 and then paste the following code into the module

Option Explicit
Dim MyStr As String

Private Sub Worksheet_Change(ByVal Target As Range)
MyStr = Target.Address
Range(MyStr).Copy
Sheets(2).Range(MyStr).PasteSpecial
Application.CutCopyMode = False
End Sub

Hope this is of some help to you

S

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Retreiving Sheet1 Data Autometically Uploaded in Sheet2

I modified your code to get ride of the errors

Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ErrorReturn
If Target.Column < 5 Then
'Assume, that you have 4 columns from A to D
MyRange = "A" & Format(Target.Row) & ":C" & Format(Target.Row)
Worksheets("Sheet1").Range(MyRange).Copy _
Destination:=Worksheets("Sheet2"). _
Range("A" & Format(Target.Row))
'You can use "A:C" Range or, walk thru all .Areas
Worksheets("Sheet2").Range("D" & Format(Target.Row)).Copy _
Destination:=Worksheets("Sheet1"). _
Range("D" & Format(Target.Row))
'If you want to return your calculations in Column D.
'Use "D:D" again to avoid .Areas
MsgBox ("processing")
End If
ErrorReturn:
Application.EnableEvents = True

End Sub


"Akash" wrote:

Hi,

I have a Querry regarding Macros.

I have Two Sheets
In Sheet 1 i have Three Columns

A1. Item Name
B1. Item Qty
C1. Item Price

In Sheet 2 i have 4 Columns

A1. Item Name
B1. Item Qty
C1. Item Price
D1. Calculations

Now i want that as soon as the user enters the Data in Sheet1 it
should autometically gets uploads in the Sheet2.

Right Now i am using the following Formula in Sheet2.
=TRIM('Sheet1'!A1)
=TRIM('Sheet1'!B1)
=TRIM('Sheet1'!C1)

I try the below mentioned code sugested by Nopik on 8th March 2007,
but its not working properly.

Can anyone help me in this regards

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column < 5 Then 'Assume, that you have 4 columns from A to D
Range(Worksheets("Sheet1").Range("A" & Format(Target.Row) & ":C" &
Format(Target.Row))).Copy Worksheets("Sheet2").Range("A" &
Format(Target.Row) & ":C" & Format(Target.Row)) 'You can use "A:C"
Range or, walk thru all .Areas
Range(Worksheets("Sheet2").Range("D" & Format(Target.Row))).Copy
Worksheets("Sheet1").Range("D" & Format(Target.Row)) 'If you want to
return your calculations in Column D. Use "D:D" again to avoid .Areas
processing
End If
End Sub

Thanks

Akash


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 data from sheet2 to sheet1 when sheet2 has variable # of rows Anne Excel Discussion (Misc queries) 6 February 27th 09 09:48 PM
Sheet1 Data Autometically Uploaded in Sheet2 Akash Excel Programming 2 March 8th 07 10:19 AM
Retrieving Data from Sheet1 into Sheet2 Akash Excel Programming 0 March 1st 07 11:08 AM
Data of Sheet1 should gets autometically posted in Sheet2 Akash Excel Programming 2 February 24th 07 05:56 AM
copying data from sheet1 to sheet2 Rookie Excel Worksheet Functions 3 September 7th 06 12:09 PM


All times are GMT +1. The time now is 07:48 AM.

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"