Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Excel
123quattro
charting
crashesgpfs
datamap
excel
interopoledde
links
misc
newusers
printing
programming
querydao
sdk
setup
templates
worksheet.functions
  
 
date: Tue, 8 Jul 2008 16:33:02 -0700,    group: microsoft.public.excel.newusers        back       


How do I combine MACROS and functions?   
I'm copying and pasting onto excel from an accounting program, and it's 
pretty inconsistant.  Whenever a new heading pops up, it either deposits the 
first cell in the A column, and the second cell in the C column, or it 
deposits the first cell in the B column, and the second cell in the C column. 
 I can write a function to identify this 
=IF(A#="",IF(B#="","","deleteA"),"deleteB") where # stands for whatever row I 
happen to be in.  And I figured out how to write a MACRO to delete a specific 
cell.  But with six thousand rows, and doing this pretty often, it sure would 
be nice to automate it.  Any ideas?
date: Tue, 8 Jul 2008 16:33:02 -0700   author:   Mr_Crowe

Re: How do I combine MACROS and functions?   
On Tue, 8 Jul 2008 16:33:02 -0700, Mr_Crowe
 wrote:

>I'm copying and pasting onto excel from an accounting program, and it's 
>pretty inconsistant.  Whenever a new heading pops up, it either deposits the 
>first cell in the A column, and the second cell in the C column, or it 
>deposits the first cell in the B column, and the second cell in the C column. 
> I can write a function to identify this 
>=IF(A#="",IF(B#="","","deleteA"),"deleteB") where # stands for whatever row I 
>happen to be in.  And I figured out how to write a MACRO to delete a specific 
>cell.  But with six thousand rows, and doing this pretty often, it sure would 
>be nice to automate it.  Any ideas?

I'm not sure what you want to do.  The logic of your function says 
if there is anything in A#, delete whatever is in B#, 
otherwise if there is anything in B#, delete whatever is in A#.  
And don't delete anything if there is nothing in A# or B#.

But the second part is redundant since there couldn't be anything in A# to
delete.

Your description suggests that there will be data in either A# or B#.

Perhaps something like this would put all the new headings into col A:

=============
Option Explicit
Sub Foo()
Dim c As Range
For Each c In Range("A1:A6000")
  With c
    If .Value = "" Then .Value = .Offset(0, 1).Value
        .Offset(0, 1).ClearContents
  End With
Next c
End Sub
================

But again, I'm not sure if that is what you want.  
--ron
date: Tue, 08 Jul 2008 21:23:42 -0400   author:   Ron Rosenfeld

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us