Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: manupulating rows and values

    I am new to programming in Excel. My problem is, I am coding a macro to joincells. The problem is that the row can happen anywhere throughout the report. I was able to use the find function to find the begining of row and able to do what I need, but can't deterine where to break out of the loop.

    Here is the code I'm using:

    Public Function NewFind()
    Dim currRow As Integer
    Dim currcell As String
    Dim y As String
    Dim r As String

    With Worksheets(1).Range("a1:a500")
    Set C = .Find("DATE", LookIn:=xlValues)
    currRow = C.row
    currRow = currRow + 2

    currcell = "G" & currRow
    y = "I" & currRow
    r = currcell & ":" & y
    JoinCells Range(r), AndCenter:=False
    currRow = currRow + 1

    Loop While Worksheets(1).Range("A:" & currRow) Is Nothing

    End With
    End Function

    Any help would greatly appreciated. If there is a better way to code this whole thing, that would be helpful too.

  2. #2
    Join Date
    Sep 2003
    Cincinnati, Oh USA
    Well, I'm not to sure about this, but as I review your code, it appears that you are seeking a specific date. So, I'd use the date to create the bail out point.

    Sub FindDate()
    Dim r as Range
    Dim dt as Date
    Dim strDate as String
    strDate = "01/25/03"
    For Each r In Range ("A1:A" & Cells(Rows.Count,"A").End(xlUp).Row)
    If r.value = strDate then
    Exit Sub (or some other action)
    ElseIf r.Value <>strDate
    End If
    End Sub

    The Date your require can be placed into the sub by referencing a cell or from a user form.
    Good luck

Posting Permissions

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