Transfer activex textbox value to table on another sheet

Mikeymike_W

Board Regular
Joined
Feb 25, 2016
Messages
171
Hi,

I have a sheet called "CLP", there are several activex textboxes in this sheet.
I want to use VBA to transfer the values of each textbox into a specific named range on a table ("Data") that's on sheet "CLP Client Data"

So for example on sheet "CLP" there is a textbox named "TBDate", i want the value of this to be placed in the table "Data" under the named row "Date".

I have done something similar in other sheets but never from an activex textbox.
I have the code below but it throws up an error once it gets to the first line regarding the textboxes.

Thanks in advance for all your help,

Mike

VBA Code:
Dim rw As Long    'next available row
Dim sPath As String, i As Long
Dim ws As Worksheet
        Set ws = Worksheets("CLP Client Data")
   
    Sheets("CLP Client Data").Select
  
    ActiveSheet.Range("A3").Select
   
      ws.ListObjects("Data").ListRows.Add
        rw = Split(ws.ListObjects("Data").DataBodyRange.Address, "$")(4)

      'put the text box values in this row
      With ws
     
      .Cells(rw, "Date").Value = TBDate.Value
      .Cells(rw, "ClientID").Value = TBName.Value
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

NoSparks

Well-known Member
Joined
Mar 15, 2013
Messages
1,354
Office Version
  1. 2010
Platform
  1. Windows
try
VBA Code:
      .Cells(rw, "Date").Value = Sheets("CLP").OLEObjects("TBdate").Object.Value
 
Solution

Mikeymike_W

Board Regular
Joined
Feb 25, 2016
Messages
171
Hi Nosparks,

Thanks very much for the help, tried it out and it works a charm, thanks you.

Part of the problem was that i had it in a module too so have moved it into the sheet.

Thanks very much for your help,

Mike
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,193
Messages
5,768,772
Members
425,492
Latest member
blueexcel123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top