Variant Question

ummjay

Board Regular
Joined
Oct 1, 2010
Messages
193
Hi! i'm trying to set a variant to a specific cell on the macro workbook, and retain that throughout my code. for some reason it' showing as empty, even though I have a value in that cell on the macro WB.

Any ideas?

VBA Code:
Set macroWB = ActiveWorkbook
Name = macroWB.Range("P10").Value

'set Range
Dim lr&: lr = ActiveSheet.Cells.Find("*", [A1], _
    xlFormulas, SearchDirection:=xlPrevious).Row
Set WBrng = Range("A1:J" & lr)
WBrng.Copy

Set Wb = Workbooks.Add(1)
    With Wb.Sheets(1)
        .Cells(1).PasteSpecial Paste:=8
        .Cells(1).PasteSpecial xlPasteValues, , False, False
        .Cells(1).PasteSpecial xlPasteFormats, , False, False
        .Cells(1).Select
        Application.CutCopyMode = False
        On Error Resume Next
        .DrawingObjects.Visible = True
        .DrawingObjects.Delete
        On Error GoTo 0

    Set Wb = ActiveWorkbook ' or a specific open workbook
    sPath = CreateObject("WScript.Shell").SpecialFolders("Desktop")
    sFile = "Name " & Format(Now(), "mmddyyyy") & ".xlsx"
    Wb.SaveAs Filename:=sPath & "\" & sFile

    End With
''end
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Change: Name = macroWB.Range("P10").Value ' The name of the sheet is missing

To: Name = macroWB.Sheets("abc").Range("P10").Value
 
Upvote 0
Solution

Forum statistics

Threads
1,223,714
Messages
6,174,052
Members
452,542
Latest member
Bricklin

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