View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default If then Help is greatly appreciated!

Dave,

Sorry for the double reply....

This is what I have done and it works to Perfection! THANKS!!!!

'Adds Rep Name in Last Column of Call Summary
Dim LastRow As Long
With Worksheets("Call Summary")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("q1:Q" & LastRow).Formula _
= "=if(a1=""* Rep Summary"",d1,"""")"

This I added at the end of your code...

Worksheets("Call Summary").Select
Range("q1:Q" & LastRow).Select
Dim Cell As Range
For Each Cell In Selection
Cell.Value = Cell.Value
Next

End With

I now have 2 questions:

1) (.Rows.Count, "A")....what does the "A" stand for or mean?? I am
very new to VBA...about a month or so...and I understand what most of
your code is doing, but this one I do not.

2) In the macro where this is assigned; Multiple calculations,
retrieving data etc... are being done...Your code is much cleaner than
what I was utilizing before so I copied it again and made some changes.
The next section of code is this:


'Gets Time in Stores
With Worksheets("Summary")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("D40:D" & LastRow).Formula _
= "=IF(ISERROR(INDEX('Rep Performance
Analysis'!G:G,MATCH(Summary!C40,'Rep Performance
Analysis'!B:B,0))),"""",INDEX('Rep Performance
Analysis'!G:G,MATCH(Summary!C40,'Rep Performance Analysis'!B:B,0)))"


End With

What I would like to do is add this at the end:

Worksheets("Summary").Select
Range("D40:D" & LastRow).Select
Dim Cell As Range
For Each Cell In Selection
Cell.Value = Cell.Value
Next

But, as you probably already know this gives me an error; "Duplicate
error in current scope" I will need to do the "value only" part several
times and each time it refers to a different section of the
workbook,sheets etc... Would I be better off waiting to do this until
the very end of the code or do something different?
I hope this makes sense....

Thanks

Hans