Pulling column reference out of RefEdit control

jbrouse

Active Member
Joined
Apr 28, 2005
Messages
329
I am in charge of reviewing changes in our company's shipping schedule, and I will frequently get updated information that has maybe 100 columns and any number of rows. I never know what the column headers are going to be. Currently, I have to copy all of the volume information by hand into another worksheet, which is rather tedious. I am trying to make a program that will do all of this for me, and I'm stuck on this one point.

I have made a userform (UserForm1) that allows me to pick the range of data using a RefEdit control. Ideally, I would like to use the userform to pick only the column headers and have my program copy all of the data (minus the column header) in those columns into my other worksheet.

If I have in my RefEdit control a cell reference of 'Sheet1'!$R$2:$Z$2, how can I reference just the column information so that I can copy all of my data?

Thanks in advance
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
let's say your refedit is called myRefEdit

set wholeColRange = range(me.myRefEdit.value).columns

assuming the code is in the userform
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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