Results 1 to 7 of 7

VBA/Macros to Control Active Cell

Threaded View

  1. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,824

    Re: VBA/Macros to Control Active Cell

    Updated version: now adds records to the end.

    Private Sub CommandButton2_Click()
    
    Worksheets("RO-CT Database").Activate
    
    lr = Cells(Rows.Count, "A").End(xlUp).Row + 1
    
    For i = 1 To 17
    Cells(lr, i) = Me.Controls("TextBox" & i)
    If i = 3 Then Cells(lr, 3) = UCase(Me.Controls("TextBox" & i))
    If i >= 4 Then Cells(lr, i) = Val(Cells(lr, i))
    Next
    
    End Sub
    
    
    
    Private Sub CommandButton4_Click()
    
    Worksheets("Daily Database").Activate
    
    lr = Cells(Rows.Count, "A").End(xlUp).Row + 1
    
    For i = 1 To 3
    Cells(lr, i) = Me.Controls("TextBox" & 32 + i)
    If i = 1 Then Cells(lr, i) = DateValue(Cells(lr, i))
    If i = 3 Then Cells(lr, i) = Val(Cells(lr, i))
    Next
    
    For i = 1 To 3
    
    Cells(lr, i + 4) = Me.Controls("TextBox" & 35 + i)
    If i = 1 Then Cells(lr, i + 4) = DateValue(Cells(lr, i + 4))
    If i = 3 Then Cells(lr, i + 4) = Val(Cells(lr, i + 4))
    Next i
    
    For i = 1 To 6
    Cells(lr, i + 8) = Me.Controls("TextBox" & 38 + i)
    If i = 1 Then Cells(lr, i + 8) = DateValue(Cells(lr, i + 4))
    If i >= 2 Then Cells(lr, i + 8) = Val(Cells(lr, i + 8))
    Next
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 03-03-2014, 09:06 PM
  2. Active X Check Box that will perform certain macros based upon cell values
    By houseflipsheet in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-06-2014, 12:31 AM
  3. [SOLVED] VBA Code to have a repeating form control /Active X control (List box) in every row
    By Ehezve in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2013, 08:55 PM
  4. active cell control using scripts
    By Robin01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2006, 07:45 PM
  5. [SOLVED] In macros, an instruction that will return the position of the Active Cell
    By aca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2006, 07:00 PM
  6. Replies: 2
    Last Post: 01-20-2006, 11:00 AM
  7. [SOLVED] Adding a control button to insert a date in the active cell.
    By Mike in forum Excel General
    Replies: 2
    Last Post: 02-15-2005, 03:06 PM

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