+ Reply to Thread
Results 1 to 4 of 4

Thread: Macro in Userform miswrite

  1. #1
    Registered User
    Join Date
    09-28-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Macro in Userform miswrite

    I have pasted the VBA code below for a project I am working on. Having an issue where the second iteration overwrites the first result, but then the worksheet functions normally. Can't find where the problem is. Appreciate any help!

    Private Sub SendInfo_Click()
    'Variable Creation
    Dim NextRow As Long

    'Activate Sheet2
    Sheets("Input Page").Activate

    'Shift Rows Down
    Range("A7:G7").Select
    Selection.Copy
    Range("A7:G7").Select
    Selection.Insert Shift:=xlDown

    'Discover empty Row
    NextRow = Application.WorksheetFunction.CountA(Range("B:B")) + 1

    'Description
    Cells(NextRow, 2) = Description.Text

    'Category
    If RentCat Then Cells(NextRow, 3) = "Rent"
    If RStepCat Then Cells(NextRow, 3) = "Rent Steps"
    If TICAT Then Cells(NextRow, 3) = "Tenant Improvement Allowance"
    If LLWorkCat Then Cells(NextRow, 3) = "Landlord Work"
    If LCICAT Then Cells(NextRow, 3) = "Lease Capital- Inside"
    If LCOCAT Then Cells(NextRow, 3) = "Lease Capital- Outside"

    'Characterization
    If Onetime Then Cells(NextRow, 4) = "One-Time"
    If Recurring Then Cells(NextRow, 4) = "Recurring"
    If Upfront Then Cells(NextRow, 4) = "Upfront"

    'Month Occurs
    Cells(NextRow, 5) = MonthOccursText.Text

    'Months Recurring
    Cells(NextRow, 6) = MonthsRecurText.Text

    'Growth
    'Cells(NextRow, 7) = GrowthText.Text
    'If Cells(NextRow, 7) > 0 Then Cells(NextRow, 7).Value = GrowthText.Value / 100 Else
    'Cells(NextRow, 7).Value = GrowthText.Value / 100
    '.Offset(RowCount, 6).Value = Me.txt_forv_timer.Value / 100
    '.Offset(RowCount, 7).Value = Me.txt_forv_oms.Value / 100

    'DollarAmount
    Cells(NextRow, 7) = DollarAmount.Text

    'Close
    Unload Me

    End Sub

  2. #2
    Registered User
    Join Date
    09-28-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Macro in Userform miswrite

    The problem is the way I am selecting/defining NextRow. I just want it to constantly by row 7. How do I do that?

  3. #3
    Registered User
    Join Date
    09-28-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Macro in Userform miswrite

    Solved. Amazing. NextRow = 7

  4. #4
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: Macro in Userform miswrite

    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
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ 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.2.0