Sub ImportFromCustomerDatabase()
Dim Inputs As Worksheet, Settings As Worksheet, CellRefNames As Worksheet
Dim DatabaseName As String, Folder As String, FirstRow As Integer
Dim Data_Values As Worksheet, Data_Formulas As Worksheet, SaveHistory As Worksheet
Dim CustomerCount As Integer, CustomerRow As Integer, ColumnsCount As Integer
Dim CurrentNamesColumn, StorageColumn As Integer, StartRow As Integer, EndRow As Integer
Dim StorageArray()
Set Inputs = Sheets("Inputs")
Set Settings = Sheets("Settings & Support")
Set CellRefNames = Sheets("CellRefNames")
' Step 1: Store the Inputs page info for undo
Application.ScreenUpdating = False
CurrentNamesColumn = CellRefNames.Rows(8).Find("CustData--CurrentNames").Column
StorageColumn = CellRefNames.Rows(8).Find("CustData--Storage").Column
StartRow = CellRefNames.Columns(1).Find("RefNamesStart").Row + 1
EndRow = CellRefNames.Columns(1).Find("RefNamesEnd").Row - 1
ReDim StorageArray(1 To EndRow - StartRow + 30)
For i = StartRow To EndRow
If CellRefNames.Cells(i, CurrentNamesColumn) <> "" Then
StorageArray(i - StartRow + 1) = _
Range(CellRefNames.Cells(i, CurrentNamesColumn).Value).Formula
Else: StorageArray(i - StartRow + 1) = ""
End If: Next i
With CellRefNames: .Range(.Cells(StartRow, StorageColumn), .Cells(EndRow, _ StorageColumn)).Value = Application.Transpose(StorageArray): End With
' Returns 'Type Mismatch error
Application.ScreenUpdating = True
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE