Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default If then Help is greatly appreciated!

If then statements have for some reason left me dumbfounded!
This is what I need to do in VBA:
Look in Cell A1 for "*Rep Summary", if it exists look in cell D10 for
the reps name and give me that name in cell q10. If "* Rep Summary",
does not exist then return nothing.
Lastly; repeat this down the column Q:Q, until there is no data left in
Column A:A.

Thanks for your help...this one as I stated before as left me with a
definite "DUUUHHHH!"

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default If then Help is greatly appreciated!

This formula goes in Q10:

=if(a1="*Rep Summary",d10,"")

Watch out. Once you used "*Rep Summary" and the other time "* Rep Summary".

If a1 can contain other stuff along with "Rep Summary", you could use:

=if(countif(a1,"*rep summary*")0,d10,"")

(the asterisks are wild cards in that last formula.)

And drag it down as far as you need.

Debra Dalgleish has instructions with pictures:
http://contextures.com/xlDataEntry01.html#Mouse

" wrote:

If then statements have for some reason left me dumbfounded!
This is what I need to do in VBA:
Look in Cell A1 for "*Rep Summary", if it exists look in cell D10 for
the reps name and give me that name in cell q10. If "* Rep Summary",
does not exist then return nothing.
Lastly; repeat this down the column Q:Q, until there is no data left in
Column A:A.

Thanks for your help...this one as I stated before as left me with a
definite "DUUUHHHH!"


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default If then Help is greatly appreciated!

Dave,

Thanks for the help...but how would I go about placing this in VBA?
Currently I do this via formulation and when I send out I copy paste
into another workbook. The reason I want to convert to VBA is that I
can send out the actual workbook and stop the double work.
As for your "Watch Out"; I didn't state it plainly. If "* Rep Summary"
does not exist in cell A1, do nothing. Does that help in explaining
what I need it to do?

Thanks,

Hans

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default If then Help is greatly appreciated!

This formula:

=if(a1="*Rep Summary",d10,"")

Seems kind of strange to copy down a range. In most cases I've seen, when I
want to copy down a range, the formula refers to cells on the same row--not a
cell 9 rows down.

But you can do this kind of thing:

Option Explicit
sub testme()
dim LastRow as long
with worksheets("Sheet99")
lastrow = .cells(.rows.count,"A").end(xlup).row

.range("q1:Q" & lastrow).formula _
= "=if(a1=""* Rep Summary"",d10,"""")"
end with
end sub

But I ended up with formulas in Q1:Qxxx that looked like:

=IF(A1="* Rep Summary",D10,"")
=IF(A2="* Rep Summary",D11,"")
=IF(A3="* Rep Summary",D12,"")
=IF(A4="* Rep Summary",D13,"")
=IF(A5="* Rep Summary",D14,"")
=IF(A6="* Rep Summary",D15,"")
=IF(A7="* Rep Summary",D16,"")
=IF(A8="* Rep Summary",D17,"")
=IF(A9="* Rep Summary",D18,"")
=IF(A10="* Rep Summary",D19,"")

And that just looks pretty weird to me.


" wrote:

Dave,

Thanks for the help...but how would I go about placing this in VBA?
Currently I do this via formulation and when I send out I copy paste
into another workbook. The reason I want to convert to VBA is that I
can send out the actual workbook and stop the double work.
As for your "Watch Out"; I didn't state it plainly. If "* Rep Summary"
does not exist in cell A1, do nothing. Does that help in explaining
what I need it to do?

Thanks,

Hans


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default If then Help is greatly appreciated!

Dave,
Your right, it is weird...I had a typo. It should have read =if(a1="*
Rep Summary",d1,"").
I have not tried your solution yet.
If I change the typo, will your solution work or is there another
change that I need to make?

Thanks for everything

Hans



  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default If then Help is greatly appreciated!

You'll have to fix the formula in the code.

But you should save your work before you try it. Then if it doesn't work, you
can close without saving.

" wrote:

Dave,
Your right, it is weird...I had a typo. It should have read =if(a1="*
Rep Summary",d1,"").
I have not tried your solution yet.
If I change the typo, will your solution work or is there another
change that I need to make?

Thanks for everything

Hans


--

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
The MS Graph Tool should be debugged and greatly enhanced. tomtomward Charts and Charting in Excel 0 February 22nd 06 03:41 PM
Can't quite get what I want with bar chart; help appreciated Newsman Charts and Charting in Excel 0 February 9th 06 12:38 AM
Using excel to manage event - ANY input deeply appreciated! :-) ojbelboe Excel Discussion (Misc queries) 3 January 18th 06 10:21 PM
Can't get out of selection? Assistance would be most appreciated... [email protected] New Users to Excel 4 July 13th 05 11:43 PM
Hello, again Help is appreciated Greegan Excel Worksheet Functions 0 December 17th 04 02:54 PM


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