Excel to Code

mattcasim

New Member
Joined
Jan 25, 2005
Messages
12
In a vba application, what code would I use to get the contents of a cell (e.g. G5) into a textbox1?

Also, how do you make a range of cells static so when you scroll down the workbook, those cells stay at the top always?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
For the second question, go to the row below the rows you want to stay still and go to Window->Freeze Panes.

For example, if you click in Cell C2 and go to Window->Freeze Panes, then Row 1 will stay and columns A and B will stay. If you click in cell A3, and go to Window->Freeze Panes, then rows 1 and 2 will stay.
 
Upvote 0
Try setting the LinkedCell property on the textbox to G5
 
Upvote 0
linked cell - what code do that use, say if I wanted to apply the cell contents to label1.caption or into a drop down menu?

Thanks
 
Upvote 0
LinkedCell is a property of the TextBox, because that is what you originally asked.

Can you provide some details of your project?
 
Upvote 0
I've got a basic spreadsheet but I want to add VBA and a userform so that user can change the details by using the form rather thna modifying the cells. There is a button to load the userform then I want to have a combo / list box to display current titles, from a range A2:A8 (I have named that range "title"). I need code that will load the combo box with the contents of cells A2:A8. I also need to load the contents of cell B5 into a label. (e.g. label.caption = ...) I do not know what the link cell command does as I have intermediate VB knowledge but very little knowledge of Excel so I am struggling to link the two.

Many Thanks
 
Upvote 0

Forum statistics

Threads
1,203,047
Messages
6,053,196
Members
444,645
Latest member
mee siam

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
Back
Top