473,386 Members | 1,754 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,386 software developers and data experts.

problem in macro

Hi all

i am trying to develop a macro.
the scenario is as follows,,

we have 2 sheets 1 and 2.
i want to apply a vlookup in sheet 1 and the lookup table is in sheet 2.

but in sheet 1 vlookup has to be applied for only those values in column b(for eg)
for which corresponding row in column a has some value.


now problem is if i record a macro by double clikking on cell b1(after applying the vlooku[p in b1) then in the current file it is fine.
but in the macro it records last cell number of column b.(this would be the cell number till which the macro will apply the formula)

so if i run this macro in another sheet in which no. of entries in column b are more there is a problem.

also if no. of entries are less it unnecessary calculates giving value 0.


kindly help

nikhil kumar
Jan 24 '07 #1
1 1111
Hi all

i am trying to develop a macro.
the scenario is as follows,,

we have 2 sheets 1 and 2.
i want to apply a vlookup in sheet 1 and the lookup table is in sheet 2.

but in sheet 1 vlookup has to be applied for only those values in column b(for eg)
for which corresponding row in column a has some value.


now problem is if i record a macro by double clikking on cell b1(after applying the vlooku[p in b1) then in the current file it is fine.
but in the macro it records last cell number of column b.(this would be the cell number till which the macro will apply the formula)

so if i run this macro in another sheet in which no. of entries in column b are more there is a problem.

also if no. of entries are less it unnecessary calculates giving value 0.


kindly help

nikhil kumar
Assuming this Excel you're talking about..

Could you copy and paste the VBA Macro code here so it would be easier to understand what you're trying to explain.

To find the VBA Macro code:

Go to Tools > Macro > Visual Basic Editor.

A New window should appear, you're macro code is located under the Modules in the tree view column on the left hand side of the window. Locate the macro you recorded and paste the code you see here.

halfazner
Jan 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

24
by: Bangalore | last post by:
Hi all, I have a problem in accessing elements using overloaded operator . Consider, const int SIZE=10; int FALSE=0; class Array { private: int x; public:
1
by: Giganews | last post by:
I have an Access 97 database in which I am running an Excel macro through automation. The macro in Excel is as follows: Worksheets("Sheet1").Protect Password:="****", DrawingObjects:=True,...
10
by: Karim Thapa | last post by:
Why following macro does not work? #define removebrace(x) x void Foo(int a, int b, char *txt, int d, int e); main() {
7
by: Peter Ammon | last post by:
K.N. King's book "C Programming: A Modern Approach" gives this exercise in chapter 14, which is about the preprocessor: The following macro has a subtle problem: #define ABS(a)...
1
by: Michael B Allen | last post by:
I have a macro that can be used like: E(errno); but for reasons of brevity I frequently use the form: E(errno = EINVAL); But I would like to be able to have two definitions such that it...
0
by: Chris Ellis | last post by:
Hi, I'm trying to write a macro that will generate managed c++ wrappers of map. I want a managed iterator and a managed map. I successfully built a pair of classes (iterator and map) that work...
13
by: Henry Townsend | last post by:
I hope this is on-topic in c.l.c - it's about the C preprocessor more than the language per se, more generally about the K&R behavior, and most specifically about the Sun cpp which is why I've...
26
by: empriser | last post by:
#define XLOG( ... ) \ do{ \ sprintf( SysBuf, " ", curtime(), __FILE__ , __LINE__ , __FUNCTION__ ); \ sprintf( SysBuf + strlen( SysBuf ), __VA_ARGS__ ); \ xlog( SysBuf ); \ }while(0) I...
8
by: Net | last post by:
Hi Please help. I have a database which requires a message to come up when certain part numbers are added to it. I have solved part of this by using a conditional macro eg = 54125 and using a msg...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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.