![]() |
#1
|
|||
|
|||
![]()
I have been struggling with this for days and I have tried multiple ways of getting this task done but it's always buggy. Either I get an object error with the pastespecial method or I get the object variable error with value = value, referring to the row1. If I set row1 to a range, I get the to the open.workbooks and the code stops due to a built in function. I do not know enough to fix this and I would sure appreciate some help and understanding. I just want to copy a value from an open workbook then open a closed workbook, find the value, and add an "A" six cells to the right, then close the workbook. Here's the mess I have. Please ignore the variables with "2's" I am going to delete them.
Sub Update_Log_Status2() Dim wrkbk1 As Workbook Dim sht1 As Worksheet Dim row1 As Range 'Path to closed file Const filePath1 As String = "J:\Manual PO's\Manual PO Log\Manual PO Log.xlsx" 'Stop updating the screen Application.ScreenUpdating = False ' 'Open the workbook Set wrkbk1 = Workbooks.Open(filePath1) 'Grab the first sheet in wrkbk Set sht1 = wrkbk1.Sheets(1) ![]() 'Find value in B21 of active worksheet in colum D of closed workbook row1 = sht1.Range("D ![]() sht1.Cells(row1, 10).Value = "A" 'Close workbook & save wrkbk1.Close True 'Set the screen to update Application.ScreenUpdating = True End Sub |
Tags |
closed workbook, excel vba, object variable error |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Object Variable or With block variable not set | Raza | Excel Programming | 8 | 01-15-2015 12:19 AM |
Run Time Error '91': Object variable or With block variable not set using Catalogue Mailmerge | Berryblue | Mail Merge | 1 | 11-13-2014 05:36 PM |
![]() |
JUST ME | Word VBA | 4 | 03-25-2014 06:56 AM |
![]() |
tinfanide | Excel Programming | 2 | 06-10-2012 10:17 AM |
XML parsing & Object variable not set (Error 91) | tinfanide | Excel Programming | 0 | 12-29-2011 08:43 AM |