Results 1 to 2 of 2

Troubles: setting userform- Textbox1 as a range

Threaded View

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2007
    Posts
    38

    Troubles: setting userform- Textbox1 as a range

    Hello,
    In my userform I need to use the value of TextBox1 to recalculate/renumber a cell count. The problem also being that the data from this text box will be dynamically placed anywhere within column A.
    Dim ws As Worksheet
    Set ws = Worksheets("sheet3")
    
    'This code works when selecting from a sheet
    
    Dim cell As Range
    
    'Sheets("Sheet3").Select
    'For Each cell In Range("A12", Cells(Rows.Count, 1).End(xlUp))
    'Sheets("Sheet1").Select
     ' If cell >= Range("D4") Then cell = cell + 1
    'Next
    
    'this doesnt work when selecting txtbox as range
    
    Dim cell As Range
    Sheets("Sheet3").Select
    For Each cell In Range("A12", Cells(Rows.Count, 1).End(xlUp))
    
      If cell >= Me.txtBox1.Value Then cell = cell + 1
    Next
    
    'Dim strPlace As String, strEmail As String
    'Dim strSuggestion As String
    
    Worksheets("Sheet1").Activate
    
    strPlace = Me.txtBox1.Value
    strEmail = Range("D5").Value
    strSuggestion = Range("D6").Value
    
    Worksheets("Sheet3").Activate
    Range("A12").Activate
    
    Do
    
        If ActiveCell.Value = "" Then Exit Do
        ActiveCell.Offset(1, 0).Activate
    
    Loop
    
    ActiveCell.Value = strPlace
    ActiveCell.Offset(0, 1).Value = strEmail
    ActiveCell.Offset(0, 2).Value = strSuggestion
    I think I need to find a way ofturnong the textbox.value to a range then If cell >=The range of Me.txtBox1.Value Then cell = cell + 1
    But I dont know how to get this cell count to work.

    Anyhelp/advice would be great.
    Thank-you very Much
    Last edited by baggypants; 05-03-2013 at 03:42 PM.

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