+ Reply to Thread
Results 1 to 2 of 2

Insert Text in Multiple Cells in Condition or Criteria

  1. #1
    Registered User
    Join Date
    08-20-2018
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    0

    Insert Text in Multiple Cells in Condition or Criteria

    I want to insert Text in Multiple Cells with the following Criteria using userform to input value

    Sub AddSaturdaySunday()
    ' get the last row
    Dim startRow As Long, lastRow As Long
    startRow = 14
    lastRow = Sheet1.Cells(Sheet1.Rows.Count, 1).End(xlUp).Row

    Dim i As Long, Mydate As String
    Dim sDate As String

    ' Go through the marks columns
    For i = startRow To lastRow
    Mydate = Sheet1.Range("B" & i).Value


    ' Check Mydate and classify accordingly then print Saturday and Sunday
    If Mydate = "11" Then
    sDate = "Saturday"


    ElseIf Mydate = "12" Then
    sDate = "Sunday"

    Else
    'For this part it must NOT REPLACE the value if the conditions above are not meet

    End If


    ' Write out the Saturday and Sunday column C
    Sheet1.Range("C" & i).Value = sDate
    Next

    End Sub

  2. #2
    Administrator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,142
    Hello francis.mata,

    Welcome to Excelforum. Be a part of large Excel community. Enjoy Learning.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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