Results 1 to 5 of 5

Help coding Logical function in VBA code

Threaded View

  1. #1
    Registered User
    Join Date
    12-08-2009
    Location
    Delft, The Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    10

    Help coding Logical function in VBA code

    Hello,

    I was wondering if someone could help me along with coding a logical function in Visual Basic code in a macro. I am a bit new to macro's and VBA in excel.

    The reason why I would like to code this function is because I do not want to put the logical functions in all the cells.
    My cells in the spreadsheet are only 0,3 .. wide and I would like to put some text in some cells.
    The 'false' (i.e. " ") statement in every cell would make it impossible to show text over multiple cells.

    I have an idea of what it should do, but I need a kickstart to know what I am looking for on the web. Some basic examples would help a lot!

    The file is attached, it is a gant chart spreadsheet.

    The idea.
    Sub ProAssignProjectnames()
    
    assign cell p to variable
    assign cell ps to variable
    
    For (countcolumn) is p to ps do
    For (countrow) is 5 to 12 do
    
    // Compare two cells
    if $E(countrow) = (countcolumn)$3 do
    
    // If the cells are the same the combination of the 'counters' is the new cell.
    // $C(countrow) is the text that needs to be in the new cell.
    (countcolumn)(countrow) = $C(countrow)
    
    // If the new cell is found and assigned the right text go to the next row
    next row
    
    // If the comparison is false go to the next column
    else
    next column
    
    Assign new cell (countcolumn)(countrow) in the sheet with the right text $C(countrow).
    
    End sub
    
    Optional extra: Button on the spreadsheet to run the macro.
    Hope someone can help me out.

    Thanks, Wiggert.
    Attached Files Attached Files
    Last edited by DonkeyOte; 12-09-2009 at 08:00 AM. Reason: CODE tags not QUOTE tags please

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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