LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Programming ideas for excel

Thanks for your quick reply. I ran the code with little changes to column
numbers to represent the correct columns in sheets 1 and 2.

If mySheet2.Cells(i, 7) = mySheet1.Cells(i, 10)

Upon execution, I get a code 9 " Subscript out of range" error.
I wonder why it could be happening.


Thanks again for your input.

nshring
"japfvg" wrote:

Hi,

I had this type of process regularly and what I like to do is like this:

option explicit
sub Process()
'Creating the variables and asign them the sheets you use

dim mySheet1 as worksheet, mySheet2 as worksheet
dim mySheet3 as worksheet, i as long, j as long, k as integer

set mysheet1 = worksheets("Sheet 1")
set mysheet2 = worksheets("Sheet 2")
set mysheet3 = worksheets("Sheet 3")

i = 2
j = 2
'Going through your data and comparing cells
while mysheet2.cells(i,1) < ""

'Compare the cells in the 2 worksheets
if mysheet2.cells(i,1) = mysheet1.cells(i,2) then

'Put the value of every column in sheet1 into sheet3
for k = 1 to 15
mysheet3 .cells(j,k) = mysheet1.cells(i,k)
next
j = j + 1

end if
i = i + 1

wend

If you have any questions, please let me know.
I hope this helps

"nshring" wrote:

Hello,
I have a scenario in which there is one excel 2007 workbook with three
sheets in it.
Sheet 1 is a master sheet with around 1900 rows and 15 columns of data.
Sheet 2 contains the qualifying data.
Sheet 3 is a result (or an output) sheet.

Sheet 2 has a column A with unique 5 digit integers.
The goal is to compare every cell of column A of Sheet 2 with Column B in
Sheet 1.
If there is a match, then copy that whole row of Sheet 1 into Sheet 3.
Repeat until all the cells in Column A of Sheet 2 have been compared with
Column B of Sheet 1.

What is the best way to achieve this?

Thanks much!

 
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
Ideas on how to do Stock Excel File apache007 Excel Discussion (Misc queries) 0 May 10th 09 03:46 AM
Loss Run on Excel worksheet......Any Ideas?? AK226 Excel Worksheet Functions 6 November 1st 07 05:20 PM
Any ideas of integrating Unix with Excel? Michael[_44_] Excel Programming 2 October 1st 07 10:57 AM
Converting ASCII Into Excel, any Ideas? Cantankerious Excel Discussion (Misc queries) 3 September 27th 06 07:42 PM
Programming Ideas brian Excel Programming 4 August 25th 03 04:57 PM


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