Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 11
Default Convert Column Formula into VBA codes

Reference:
http://groups.google.com/group/micro... 616e111e2f166
http://www.excelforum.com/showthread.php?t=606282

Dear Experts

Columns E has folloiwng formula

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

Code:
Sub Command1_Click() 
    Dim iRow As Long, Lastr 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
Attached Files
File Type: zip Formula to VBA.zip (6.5 KB, 66 views)
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
i have a list of 3000 zip codes, can i convert to city, st format Richardw Excel Worksheet Functions 2 December 7th 06 01:36 PM
Need to convert list of 5 digit zip codes to ranges where possible Mel07 Excel Worksheet Functions 3 March 14th 06 11:43 PM
HOW CAN I CONVERT EXCEL DATA TO BAR CODES? guyinrenton Excel Discussion (Misc queries) 1 September 14th 05 06:10 PM
HOW CAN I CONVERT EXCEL DATA TO BAR CODES? guyinrenton Excel Discussion (Misc queries) 0 September 14th 05 06:02 PM
Convert dates into codes Davin Excel Discussion (Misc queries) 2 August 31st 05 08:36 PM


All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"