Set table column's values equal to a non-table column that has a named range

sspatriots

Well-known Member
Joined
Nov 22, 2011
Messages
585
Office Version
  1. 365
Platform
  1. Windows
Is it possible to set the table column's values equal to a named range non-table column's values using VBA? I'd like the values in the non-table column to match exactly the values in the table column. I've tried a few things, but the best I could get was to have the first cell in the non-table column to go in the first cell of the table column. Nothing else would pull over into the table column. I use structured references when referring to my table columns and was trying to use a named range for the non-table column. Any help would be greatly appreciated.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Not entirely clear exactly what you are trying to do but see if this helps.

VBA Code:
Sub GetValuesFromNamedRange()
  Range("Table1[NamedRngValues]").ClearContents '<- May or may not want this line
  With Range("NamedRange")
    Range("Table1[NamedRngValues]").Resize(.Rows.Count).Value = .Value
  End With
End Sub
 
Upvote 0
Solution
Not entirely clear exactly what you are trying to do but see if this helps.

VBA Code:
Sub GetValuesFromNamedRange()
  Range("Table1[NamedRngValues]").ClearContents '<- May or may not want this line
  With Range("NamedRange")
    Range("Table1[NamedRngValues]").Resize(.Rows.Count).Value = .Value
  End With
End Sub
This worked perfectly. I have another issue after that keeps popping up after I run my code through. I'll post that under a different post title. Sometimes I stumble over some of the things that should come easier to me. Thank you.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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