How to convert a table column of formulas to values

sspatriots

Well-known Member
Joined
Nov 22, 2011
Messages
585
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a table in the code below that puts formulas all the way down the table. I'm trying to edit this code to convert all of those formulas to values once the formulas populate the same column. The column heading is called "Folder Contents". Any assistance would be greatly appreciated.

Thanks, SS

VBA Code:
Private Sub Workbook_Open()

Dim wb1 As Workbook
Dim ws1 As Worksheet
Dim tb1 As ListObject

Set wb1 = ThisWorkbook
Set ws1 = wb1.Sheets("Sheet1")
Set tb1 = ws1.ListObjects("PO2024List")

Application.DisplayAlerts = False


    Range("A3").Select
    ActiveCell.Formula2R1C1 = "=IFERROR(INDEX(FilePathList,ROW()-2),"""")"
    Range("A3").Select
     
    
Application.DisplayAlerts = True


End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I came up with this just playing around. It appears to be doing what I need it to do. However, I was wondering if there was a way to get the final value to add a prefix to each value in the table. For example, if I wanted to add something like "File Name:" to the beginning of each converted value how would I go about doing that?

VBA Code:
Private Sub Workbook_Open()

Dim myRange1 As Range

Application.DisplayAlerts = False

Set myRange1 = Range("PO2024List[Folder Contents]")

With Range("namedRange")
    .ClearContents
End With

Range("A3").Select
    ActiveCell.Formula2R1C1 = "=IFERROR(INDEX(FilePathList,ROW()-2),"""")"

With Range("namedRange")
    .Value = .Value
End With

Application.DisplayAlerts = True

End Sub
 
Upvote 0
As with many of your threads, you do not give helpers enough information to propose a solution. For example, in post 2 ..
  • you Set myRange1 = Range("PO2024List[Folder Contents]") and then proceed to use myRange1 nowhere in the rest of the code
  • you use Range("namedRange") but do not tell us what "namedRange" is or what it contains or should contain.
  • you put a formula in cell A3 but do not give us any information about whether A3 is part of myRange1 or "namedRange" or neither.
 
Upvote 0
As with many of your threads, you do not give helpers enough information to propose a solution. For example, in post 2 ..
  • you Set myRange1 = Range("PO2024List[Folder Contents]") and then proceed to use myRange1 nowhere in the rest of the code
  • you use Range("namedRange") but do not tell us what "namedRange" is or what it contains or should contain.
  • you put a formula in cell A3 but do not give us any information about whether A3 is part of myRange1 or "namedRange" or neither.
I struggle with named ranges, that's why I never know exactly how to present these sort of problems.
 
Upvote 0

Forum statistics

Threads
1,223,692
Messages
6,173,858
Members
452,535
Latest member
berdex

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