Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Populate Spreadsheet #2 from Cell references on Spreadsheet #1

Hi,
Please excuse the vagueness of my subject... let me explain:

I have a spreadsheet - called Spreadsheet #1 which has 4 columns of data:
Column 1 : Sheet Name
Column 2 : Row Number
Column 3 : Column Number
Column 4 : Value

Now, I have another spreadsheet, Spreadsheet #2 which has a number of
difference worksheets, formatting etc.
What I want to do is load the data from Spreadsheet #1 into Spreadsheet #2,
using the first 3 columns of data to identify where to put the data.

I am using the following code:
Workbooks(SourceFile).Activate
Sheets("Datasheet").Cells(1, 1).Select
While ActiveCell < ""
Workbooks("Frontend").Sheets(ActiveCell.Offset(0,
1)).Cells(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, 3)) =
ActiveCell.Offset(0, 4)
ActiveCell.Offset(1, 0).Select
Wend

But I am getting a "Type Mismatch" error.

Any suggestions or help appreciated.

Rael
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Populate Spreadsheet #2 from Cell references on Spreadsheet #1

Your offsets are wrong

Workbooks(SourceFile).Activate
Sheets("Datasheet").Cells(1, 1).Select
While ActiveCell < ""
Workbooks("Frontend").Sheets(ActiveCell).Cells(Act iveCell.Offset(0,
1), ActiveCell.Offset(0, 2)) = ActiveCell.Offset(0, 3)
ActiveCell.Offset(1, 0).Select
Wend

"rael_lucid" wrote:

Hi,
Please excuse the vagueness of my subject... let me explain:

I have a spreadsheet - called Spreadsheet #1 which has 4 columns of data:
Column 1 : Sheet Name
Column 2 : Row Number
Column 3 : Column Number
Column 4 : Value

Now, I have another spreadsheet, Spreadsheet #2 which has a number of
difference worksheets, formatting etc.
What I want to do is load the data from Spreadsheet #1 into Spreadsheet #2,
using the first 3 columns of data to identify where to put the data.

I am using the following code:
Workbooks(SourceFile).Activate
Sheets("Datasheet").Cells(1, 1).Select
While ActiveCell < ""
Workbooks("Frontend").Sheets(ActiveCell.Offset(0,
1)).Cells(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, 3)) =
ActiveCell.Offset(0, 4)
ActiveCell.Offset(1, 0).Select
Wend

But I am getting a "Type Mismatch" error.

Any suggestions or help appreciated.

Rael

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Populate Spreadsheet #2 from Cell references on Spreadsheet #1

Thanks for the response Joel.

I made the change but I was still getting the same error. I think it had
something to do with the fact that I was switching between files and MS Excel
(or me??) was getting confused with "Activecell".

So in the end, I split the solution into 2 parts:
1) Open Spreadsheet #1 and move the required sheet into Spreadsheet #2.
Close, but don't save Spreadsheet #1
2) Use the newly created sheet in Spreadsheet #2 to load the existing
sheets. Remove once done.

This seems to do the trick. It is not a very clean solution but it runs
pretty quickly and seems to be more reliable anyway...

"Joel" wrote:

Your offsets are wrong

Workbooks(SourceFile).Activate
Sheets("Datasheet").Cells(1, 1).Select
While ActiveCell < ""
Workbooks("Frontend").Sheets(ActiveCell).Cells(Act iveCell.Offset(0,
1), ActiveCell.Offset(0, 2)) = ActiveCell.Offset(0, 3)
ActiveCell.Offset(1, 0).Select
Wend

"rael_lucid" wrote:

Hi,
Please excuse the vagueness of my subject... let me explain:

I have a spreadsheet - called Spreadsheet #1 which has 4 columns of data:
Column 1 : Sheet Name
Column 2 : Row Number
Column 3 : Column Number
Column 4 : Value

Now, I have another spreadsheet, Spreadsheet #2 which has a number of
difference worksheets, formatting etc.
What I want to do is load the data from Spreadsheet #1 into Spreadsheet #2,
using the first 3 columns of data to identify where to put the data.

I am using the following code:
Workbooks(SourceFile).Activate
Sheets("Datasheet").Cells(1, 1).Select
While ActiveCell < ""
Workbooks("Frontend").Sheets(ActiveCell.Offset(0,
1)).Cells(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, 3)) =
ActiveCell.Offset(0, 4)
ActiveCell.Offset(1, 0).Select
Wend

But I am getting a "Type Mismatch" error.

Any suggestions or help appreciated.

Rael

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
Populate a spreadsheet from a data set rev Excel Worksheet Functions 1 September 26th 08 05:13 PM
Populate Excel Spreadsheet and Preserve Cell Formatting DeveloperSQL Excel Programming 3 April 12th 07 06:10 PM
Copying Spreadsheet with Cell References Into A Different Workbook MonkeyHanger Excel Discussion (Misc queries) 1 March 28th 07 03:09 PM
Using a current spreadsheet to populate a new one shadesofsisyphus Excel Discussion (Misc queries) 4 August 9th 06 08:04 PM
can you use cell references from Microsoft spreadsheet in excel ch Deb Excel Worksheet Functions 0 May 23rd 05 11:40 PM


All times are GMT +1. The time now is 10:09 AM.

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"