+ Reply to Thread
Results 1 to 2 of 2

Splitting cell if the cell value is not null

  1. #1
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    Splitting cell if the cell value is not null

    Hi Friends,

    Please go through the following code and correct it. What I want is the cell has to split if it is not null. Please tell me the logic. If it null I have to move that row to other sheet.

    please provide the logic


    Dim com_salt_batch As Variant

    Dim Wells As String


    'assigns wells field data from source sheet to Wells

    Wells = Sheets("source").Range("B" & counter).Value

    'split the current cell by the "-" character into another array
    com_salt_batch = Split(Wells, "-")
    'Merge first two split values back together and put in column A
    Sheets("11514SD").Cells(counter, "A") = com_salt_batch(0) & "-" & com_salt_batch(1)

    ' if array UBound is 2 it loads into Batch field
    If UBound(com_salt_batch) = 2 Then
    Sheets("11514SD").Cells(counter, "C") = com_salt_batch(2)
    Else
    Sheets("11514SD").Cells(counter, "B") = com_salt_batch(2)
    Sheets("11514SD").Cells(counter, "C") = com_salt_batch(3)
    End If

    Thanks & regards
    Ram

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Splitting cell if the cell value is not null

    Ram, yet again,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here



    This is your third infraction on this matter in 18 posts - I would suggest you familiarise yourself with the Forum Rules, should you continue to ignore them your account will be suspended.

+ Reply to 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