Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How to import data from Sheet1 to Sheet2 in the order I want

Data in Sheet1:
A1=5.500 B1=0.275
A2=5.625 B2=0.125
A3=5.750 B3=0.000
A4=5.875 B4= -0.125

Data in Sheet2:
A1=Sheet1!A4 B1=Sheet1!B4
A2=Sheet1!A3 B2=Sheet1!B3
A3=Sheet1!A2 B3=Sheet1!B2
..
..
..
..
Instead of linking the cell manually, what formula or shortcut should I
use to import the data in the sequece I want?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 195
Default How to import data from Sheet1 to Sheet2 in the order I want

This can be done easliy with a macro...are comfortable using a macro
for this?
A couple questions if macros are ok with you:
Does number of rows change regularly ? How many columns do you have?
Do you want formulas on sheet 2 or you just want the values?
wrote:
Data in Sheet1:
A1=5.500 B1=0.275
A2=5.625 B2=0.125
A3=5.750 B3=0.000
A4=5.875 B4= -0.125

Data in Sheet2:
A1=Sheet1!A4 B1=Sheet1!B4
A2=Sheet1!A3 B2=Sheet1!B3
A3=Sheet1!A2 B3=Sheet1!B2
.
.
.
.
Instead of linking the cell manually, what formula or shortcut should I
use to import the data in the sequece I want?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How to import data from Sheet1 to Sheet2 in the order I want

There will be hundreds of rows and column and the data changed
regularly (daily) in sheet1. I would like to be able to validate the
data on sheet2 is correct. So, maybe having the formulas shown is a
better solution?


stevebriz wrote:
This can be done easliy with a macro...are comfortable using a macro
for this?
A couple questions if macros are ok with you:
Does number of rows change regularly ? How many columns do you have?
Do you want formulas on sheet 2 or you just want the values?
wrote:
Data in Sheet1:
A1=5.500 B1=0.275
A2=5.625 B2=0.125
A3=5.750 B3=0.000
A4=5.875 B4= -0.125

Data in Sheet2:
A1=Sheet1!A4 B1=Sheet1!B4
A2=Sheet1!A3 B2=Sheet1!B3
A3=Sheet1!A2 B3=Sheet1!B2
.
.
.
.
Instead of linking the cell manually, what formula or shortcut should I
use to import the data in the sequece I want?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 195
Default How to import data from Sheet1 to Sheet2 in the order I want


try this:

Private Sub CommandButton1_Click()

' ----This sub will insert formulas in sheet2 referencing sheet1 _
but in reverse order in each column.
' Eg:
'Data in Sheet1:
'A1=5.500 B1=0.275
'A2=5.625 B2=0.125
'A3=5.750 B3=0.000
'A4=5.875 B4= -0.125

'Data in Sheet2:
'A1=Sheet1!A4 B1=Sheet1!B4
'A2=Sheet1!A3 B2=Sheet1!B3
'A3=Sheet1!A2 B3=Sheet1!B2



Dim Rw As Integer
Dim i As Integer
Dim j As Integer
Dim flipform As String
Dim LastColumn As Integer
On Error GoTo EndMacro

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False

Sheet2.Cells.ClearContents ' clear sheet2

'-----------Determine last used column------------------------
If WorksheetFunction.CountA(Cells) 0 Then
'Search for any entry, by searching backwards by Columns.
LastColumn = Sheet1.Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column


End If
'-----------reference sheet1 cells into sheet2 ------------------------
Sheet1.Select
For j = 1 To LastColumn
Range(Cells(1, j).Address, Range(Cells(65536,
j).Address).End(xlUp)).Select
Rw = Selection.Rows.Count 'Determine last used Row in column
For i = 1 To Rw
flipform = "=sheet1!" & Sheet1.Cells(i, j).Address

If Sheet1.Cells(i, j).Value < "" Then 'If
sheet1 cell is empty do not copy
Sheet2.Cells((Rw - i + 1), j).Formula =
flipform
Else
Sheet2.Cells((Rw - i + 1), j).Value = ""
End If
Next i
Next j

EndMacro:
Sheet1.Cells(1, 1).Select
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True

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
Inputting data to one worksheet for it effect another daedalus1 Excel Discussion (Misc queries) 1 June 25th 06 04:39 PM
How can I have the Import External Data dialog pop up on open? Benny Setting up and Configuration of Excel 1 November 19th 05 10:13 AM
merging sheet1 to sheet2 RyanFC Excel Worksheet Functions 3 August 22nd 05 08:55 PM
import data with macro chris_rip Excel Discussion (Misc queries) 0 July 18th 05 08:40 PM
import data using macro chris_rip Excel Discussion (Misc queries) 0 July 18th 05 08:32 PM


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