Excel 2007 range creation help

mdriver

New Member
Joined
Dec 30, 2013
Messages
21
Hello Everyone,
I would like some advice of what direction to go with the below please:

The inserted spreadsheet below consists of a named range, "CompTable1", and ultimately
copy, offset and PasteSpecial the information to what will be a named range "PrintTable1".
Easy enough and it works beautifully with lots of research, trial and error and help from my fellow board members.

As you can see, the first column of data is offset 6 columns left, the second 5 columns left and the third 5 columns left.

After this action is completed, I have an input box allowing the user to select the new range (for example, J9:N12), then selecting a pre-defined name, "PrintTable1", from a ComboBox. This named range is stored in a Public variable for future formatting/processing from other modules.

Again, works great but the input box selection seems a little redundant to me. The new range is always going to be fixed to 5 columns wide, be offset 6 columns left to begin, with the 2nd and 5th column blank for later processing, and be in line (as far as rows (for example, row 9) are concerned) with "CompTable1".

What I am wishing to work out is how to forgo the input selection box and proceed by selecting a name, "PrintTable1", and have my code reference the newly created range limits (For example, J9:N12).

Some other useful pieces of information:
This procedure currently works up to 10 CompTableX and 10 PrintTableX. Can expand later.
The blank cells are processed later with up, down or zero percent arrows based on certain criteria from the CompTable.
I use a With rangename.Cells(R,C).resize(rangename.rows.count) scenario to locate the last row in the "CompTable1" range. This how I copy, offset and PasteSpecial the values in each column.

Should I somewhow store this information in an dynamic array, preserve that array, redim then pass it to my selected combobox public variable name?
If so not sure what steps to begin. I have read how to pass a known range into an array but not one where the range is ideally not known.

Please help me get started.

Thanks,
Mark Driver


Excel 2007
JKLMNOPQRS
6Print Table 1
7DERBY DRIVE SE RATESComp. Table 1
8STATIONLEFTRIGHTLEFTRIGHT
910+70.000.0200.02010+70.000000-2.0000%-2.0000%10+70.000000
1010+75.500.0170.00010+75.500000-1.7000%0.0000%10+75.500000
1110+81.000.0200.02010+81.000000-2.0000%-2.0000%10+81.000000
1211+00.000.0200.02011+00.000000-2.0000%-2.0000%11+00.000000
Road A
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I solved my own problem on the back of a MooYah receipt in blue crayon my youngest "let me borrow" tonight!
This is how approached it.

Code:
Set UserRange = r.Cells(1, 1).Offset(0, -6).Resize(r.Rows.Count, 5)

PrintTableList.Show

UserRange.Name = PrintStrList

Set UserRange = Range(PrintStrList)

I was originally prompting the user to select the range to name after populating a predefined combobox.
This seems more efficient to me.
Thanks,
Mark Driver
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

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