Closed Thread
Results 1 to 5 of 5

Convert Column Formula into VBA codes

  1. #1
    Registered User
    Join Date
    04-26-2007
    Posts
    77

    Convert Column Formula into VBA codes

    Reference:
    http://groups.google.com/group/micro...0616e111e2f166

    Dear Experts

    Columns E has folloiwng formula

    PHP Code: 
    =IF(AND($A2>=$C$2,$A2<=$D$2),IF(COUNTIF($B$2:$B2,$B2)=1,$B2,""),""
    This works fine, But I want to fill Coulmn E with VBA codes.
    To do this, I wrote this formula but it show error
    Please help
    PHP Code: 
    Sub Command1_Click()
        
    Dim iRow As LongLastr As Long
        With Sheets
    ("sheet1")
            
    Lastr = .Range("A" & .Rows.Count).End(xlUp).Row
            
    For iRow 2 To Lastr
                
    .Cells(iRow"E").Value "=IF(AND($A3>=$C$2,$A3<=$D$2),IF(COUNTIF($B$2:$B3,$B3)=1,$B3,""),"")"
            
    Next iRow
        End With
    End Sub 
    column A has Dates as 01-07-2007,02-07-07
    Column B has cash as 10,20,30,40
    C1 has criteria1 date
    D1 has criteria2 date
    column E has unique values

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    04-26-2007
    Posts
    77
    Dear Sir,

    Your codes do not show any error message but do nothing.
    I want to Fill column D from ROW 2 to lastrow

    This is an other example, not related to this thread.
    Please Login or Register  to view this content.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why not simply copy the formula down?

    NOTE: the code provided by VBA Noob works perfectly! Wh ere have you placed it? See:

    http://www.excel-it.com/Forum/viewtopic.php?t=11
    Last edited by royUK; 07-06-2007 at 02:57 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    04-26-2007
    Posts
    77
    Dear Sir,

    I want to use VBA codes, not want to copy forumula down.

    For more description I am attaching workbook
    Attached Files Attached Files

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1