Results 1 to 3 of 3

Thread: populate default values in cell of a csv file

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    24
    Rep Power
    0

    populate default values in cell of a csv file

    Hi Team,

    Below data is from a csv file which I am generating using a macro. Data will be entered in an excel sheet and on running the macro it will generate the csv file. But the last column IS_ACTIVE is not there in my excel sheet. Its an additional column which I am adding to csv alone separately. Now I want to populate the value of the column IS_ACTIVE as YES .Its a default value for all the rows in that column. Kindly let me know the code in vba using which I can achieve the same.


    RATE_OFFERING
    S.No Rate Name CARGO TYPE PORT TRANSPORT MODE IS_ACTIVE
    SAMPLE 1 RR_TEST4 CONVENTIONAL AIRPORT AIR
    SAMPLE 2 RR_TEST5 CONVENTIONAL AIRPORT AIR
    SAMPLE 3 RR_TEST6 CONVENTIONAL AIRPORT AIR
    SAMPLE 4 RR_TEST7 CONVENTIONAL AIRPORT AIR
    SAMPLE 5 RR_TEST8 CONVENTIONAL AIRPORT AIR
    SAMPLE 6 RR_TEST9 CONVENTIONAL AIRPORT AIR
    SAMPLE 7 RR_TEST10 CONVENTIONAL AIRPORT AIR
    SAMPLE 8 RR_TEST11 CONVENTIONAL AIRPORT AIR

  2. #2
    Senior Member alansidman's Avatar
    Join Date
    Apr 2012
    Posts
    125
    Rep Power
    13
    Assuming your column to insert the value in is "H"

    Code:
    Sub yes()
    
        Dim lr As Long
        lr = Range("A" & Rows.Count).End(xlUp).Row
    
        Range("H1 :H" & lr).Value = "Yes"
    End Sub

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    24
    Rep Power
    0
    Hi,

    Thanks for the code,

    I tried the below piece of code since mine is the modification in the new csv file being genarated in the same csv


    Code:
     wbkNew.Sheets(1).Range("L3").Activate         'DOMAIN_NAME
                     For i = 1 To wbkNew.Sheets(1).Range("A1").End(xlDown).Row - 2
                    ActiveCell.Value = "GRK"
                    ActiveCell.Offset(1).Activate
                    Next i
                    wbkNew.Sheets(1).Range("A1").Activate
    This works fine

Similar Threads

  1. Macro to fetch csv file and edit the file
    By dhivya.enjoy in forum Excel Help
    Replies: 6
    Last Post: 10-23-2013, 01:00 PM
  2. Replies: 4
    Last Post: 06-20-2013, 04:25 PM
  3. Importing a csv File to a range
    By SDruley in forum Excel Help
    Replies: 21
    Last Post: 11-20-2012, 04:54 PM
  4. Default Cell Format Changed to Date
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 05-07-2012, 10:14 PM
  5. Save File In CSV Format VBA
    By Raj Kumar in forum Excel Help
    Replies: 3
    Last Post: 06-01-2011, 07:22 AM

Posting Permissions

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