Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Data Gladiator
 
Posts: n/a
Default Specifying Row / Column in Import File


Hello, first time poster here...

I've a question regarding the import of Excel data. I'm going to be
creating a flat file on a mainframe, copying it down to a PC and using
Excel to import it. I have a template that has cells and calculations
associated with it. Now, what I would like to do is to have the
mainframe prefix a record with a row / column coordinate, for example:

A1,Data for Cell A1
B1,Data for Cell B1
A2,Data for Cell A2
... etc.

This is a simple example, but the program on the mainframe will output
the cell address based upon some rules as it rolls through the data.
How can I translate the prefix into a cell adress telling Excel where
to load the value? I don't have a choice, the data is used for auditing
and has to fit in certain places.

If you could point me to some functions that would do this, I would be
grateful, my knowledge of Excel is fairly limited.

TIA,
DG


--
Data Gladiator
------------------------------------------------------------------------
Data Gladiator's Profile: http://www.excelforum.com/member.php...o&userid=30166
View this thread: http://www.excelforum.com/showthread...hreadid=498474

  #2   Report Post  
Posted to microsoft.public.excel.misc
Data Gladiator
 
Posts: n/a
Default Specifying Row / Column in Import File


Anyone? <bump


--
Data Gladiator
------------------------------------------------------------------------
Data Gladiator's Profile: http://www.excelforum.com/member.php...o&userid=30166
View this thread: http://www.excelforum.com/showthread...hreadid=498474

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Specifying Row / Column in Import File

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range
Dim testRng As Range
Dim curWks As Worksheet
Dim newWks As Worksheet

Set curWks = ActiveSheet
Set newWks = Worksheets.Add '(or any existing worksheet???)

With curWks
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRng.Cells
Set testRng = Nothing
On Error Resume Next
Set testRng = newWks.Range(myCell.Value)
On Error GoTo 0
If testRng Is Nothing Then
myCell.Offset(0, 2).Value = "Invalid Address"
Else
myCell.Offset(0, 2).Value = "ok"
testRng.Value = myCell.Offset(0, 1).Value
End If
Next myCell
End Sub

I'm assuming that you've already imported the data into columns A and B. I put
a comment in column C if it worked/failed.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Data Gladiator wrote:

Hello, first time poster here...

I've a question regarding the import of Excel data. I'm going to be
creating a flat file on a mainframe, copying it down to a PC and using
Excel to import it. I have a template that has cells and calculations
associated with it. Now, what I would like to do is to have the
mainframe prefix a record with a row / column coordinate, for example:

A1,Data for Cell A1
B1,Data for Cell B1
A2,Data for Cell A2
.. etc.

This is a simple example, but the program on the mainframe will output
the cell address based upon some rules as it rolls through the data.
How can I translate the prefix into a cell adress telling Excel where
to load the value? I don't have a choice, the data is used for auditing
and has to fit in certain places.

If you could point me to some functions that would do this, I would be
grateful, my knowledge of Excel is fairly limited.

TIA,
DG

--
Data Gladiator
------------------------------------------------------------------------
Data Gladiator's Profile: http://www.excelforum.com/member.php...o&userid=30166
View this thread: http://www.excelforum.com/showthread...hreadid=498474


--

Dave Peterson
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
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
Positioning Numeric Values Resulting from 6 Column Array Formula Sam via OfficeKB.com Excel Worksheet Functions 2 January 5th 06 02:03 AM
Help...Need to modify data within a column in a .csv file [email protected] Excel Worksheet Functions 11 October 26th 05 11:23 PM
Importing csv file all data is in first column SteinS, Oslo Excel Worksheet Functions 0 September 26th 05 03:10 PM
Vlookup - name of file to get info from is in Column A DD1 Excel Discussion (Misc queries) 3 August 11th 05 06:55 AM


All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"