473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Macro pastes rather than evaluates

I inherited an excel macro that compares two different worksheets and
matches rows from worksheet 2.

I created a module that would let me know if there are any duplicates
in worksheet 2. The problem is when I run this macro it does not yield
a result but rather shows me the formulas that comprise the macro and
also states something is wrong within my formulas!

Would you have any idea how to actually get my module/macro to evaluate
rather than just pasting the formulas as it is doing now?

(Please note that that worksheet2 is in format text when I run the
below macro)
Any help would be greatly appreciated::

Sub DupeCheck()
'
' DupeCheck Macro
'

'
Application.ScreenUpdating = False
Sheets("Worksheet2").Select
Range("O1").Select
ActiveCell.FormulaR1C1 = "=E1&F1&G1&K1"
Range("P1").Select
ActiveCell.FormulaR1C1 = "=if(countif($O$1:O1,O1)>1,"Dupe","")"
Range("O1").Select
Selection.AutoFill Destination:=Range("O1:O10000"),
Type:=xlFillDefault
Range("O1:O10000").Select
ActiveWindow.SmallScroll ToRight:=2
ActiveWindow.SmallScroll Down:=-27
Range("P1").Select
Selection.AutoFill Destination:=Range("P1:P10000"),
Type:=xlFillDefault
Range("P1:P10000").Select
Range("P10001").Select
ActiveCell.FormulaR1C1 = "=counta(P1:P10000)"
Range("P10001").Select
ActiveWindow.SmallScroll Down:=-15
Sheets("Worksheet1").Select
Range("F14").Select
ActiveCell.FormulaR1C1 = "=IF('Worksheet2'!A1=0,"","Possible Dupes
= &"'Worksheet2'!A1)"
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
Sheets("Worksheet2").Select
Range("O1:P10001").Select
Selection.ClearContents
Range("A1").Select
ActiveWindow.ScrollColumn = 1
Sheets("Worksheet1").Select
Application.ScreenUpdating = True

End Sub

Jun 12 '06 #1
1 1669

Might be an idea to ask in a newsgroup that caters for Excel questions
rather than this one which is for MS Access.

--

Terry Kreft
"David" <du****@yahoo.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
I inherited an excel macro that compares two different worksheets and
matches rows from worksheet 2.

I created a module that would let me know if there are any duplicates
in worksheet 2. The problem is when I run this macro it does not yield
a result but rather shows me the formulas that comprise the macro and
also states something is wrong within my formulas!

Would you have any idea how to actually get my module/macro to evaluate
rather than just pasting the formulas as it is doing now?

(Please note that that worksheet2 is in format text when I run the
below macro)
Any help would be greatly appreciated::

Sub DupeCheck()
'
' DupeCheck Macro
'

'
Application.ScreenUpdating = False
Sheets("Worksheet2").Select
Range("O1").Select
ActiveCell.FormulaR1C1 = "=E1&F1&G1&K1"
Range("P1").Select
ActiveCell.FormulaR1C1 = "=if(countif($O$1:O1,O1)>1,"Dupe","")"
Range("O1").Select
Selection.AutoFill Destination:=Range("O1:O10000"),
Type:=xlFillDefault
Range("O1:O10000").Select
ActiveWindow.SmallScroll ToRight:=2
ActiveWindow.SmallScroll Down:=-27
Range("P1").Select
Selection.AutoFill Destination:=Range("P1:P10000"),
Type:=xlFillDefault
Range("P1:P10000").Select
Range("P10001").Select
ActiveCell.FormulaR1C1 = "=counta(P1:P10000)"
Range("P10001").Select
ActiveWindow.SmallScroll Down:=-15
Sheets("Worksheet1").Select
Range("F14").Select
ActiveCell.FormulaR1C1 = "=IF('Worksheet2'!A1=0,"","Possible Dupes
= &"'Worksheet2'!A1)"
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
Sheets("Worksheet2").Select
Range("O1:P10001").Select
Selection.ClearContents
Range("A1").Select
ActiveWindow.ScrollColumn = 1
Sheets("Worksheet1").Select
Application.ScreenUpdating = True

End Sub

Jun 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: lgn | last post by:
I have test the following program, why the result is not 0 2 4 but 0 2 3? Can someone tell me why the same macro produce different result? Thanks! #include <stdio.h> #define max(a,b) ((a)>(b) ?...
8
by: sathyashrayan | last post by:
/* ** PLURALTX.C - How to print proper plurals ** public domain - original algorithm by Bob Stout */ #include <stdio.h> #define plural_text(n) &"s"
10
by: SRR | last post by:
Can anyone tell me if it is really possible to do declare 100 variables without "explicitly typing it"? Consider the following: int var1=0; int var2=0; ........... ............ int var99=0;...
6
by: Michael B Allen | last post by:
Hi, I have a macro that looks like the following: #define MMSG msgno_loc0(LOC0, LOC1) && msgno_mmsg0 which if used in some code like: MMSG("foo=%s", foo);
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.