I have a booking system (plain drop down list feeding into VLOOKUP fields). I want to be able to copy the information across and I can do this easily. The problem is that I want the sheet to allow multiple bookings and every time one booking is done to allow a second one to be done. At the moment it just rewrites the previous booking, it won't move down the available cells!
Below is the code used, I know it could be neater but I am looking as to why it doesn't work. I have an error displaying on the With section 424 it comes up with and usually complains about UsedRange.
Sub Bookingtry()
'
' Bookingtry Macro
'
' Keyboard Shortcut: Ctrl+h
'
Range("A2").Select
Sheets("Booking Form").Select
Range("B2").Select
Selection.Copy
Sheets("Booking sheet").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B2").Select
Sheets("Booking Form").Select
Range("B4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking sheet").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C2").Select
Sheets("Booking Form").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking sheet").Select
Range("C2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("D2").Select
Sheets("Booking Form").Select
Range("B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking sheet").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("E2").Select
Sheets("Booking Form").Select
Range("B10").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking sheet").Select
Range("E2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Booking Form").Select
Range("B12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking sheet").Select
Range("F2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("G2").Select
Sheets("Booking Form").Select
Range("B14").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Booking sheet").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
With Sheets("Booking sheet").Cells(UsedRange.Columns(1).Rows.Count + 1, 1).Paste
End With
End Sub
I clean you code to see what you were trying to do, I guess that I'm ok for the first part.
But for your last "line" (the With with UsedRange), I don't really get what you are trying to paste... Everything else was already pasted. Anyway, I corrected the syntax of that last part too so that you can use it.
Give this a look :
Sub Bookingtry()
' Keyboard Shortcut: Ctrl+h
Dim FirstEmptyRow As Long, _
WsBF As Worksheet, _
WsBS As Worksheet
Set WsBF = ThisWorkbook.Sheets("Booking Form")
Set WsBS = ThisWorkbook.Sheets("Booking sheet")
FirstEmptyRow = WsBS.Range("A" & WsBS.Rows.Count).End(xlUp).Row + 1
WsBF.Range("B2").Copy
WsBS.Range("A" & FirstEmptyRow).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
WsBF.Range("B4").Copy
WsBS.Range("B" & FirstEmptyRow).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
WsBF.Range("B6").Copy
WsBS.Range("C" & FirstEmptyRow).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
WsBF.Range("B8").Copy
WsBS.Range("D" & FirstEmptyRow).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
WsBF.Range("B10").Copy
WsBS.Range("E" & FirstEmptyRow).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
WsBF.Range("B12").Copy
WsBS.Range("F" & FirstEmptyRow).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
WsBF.Range("B14").Copy
WsBS.Range("G" & FirstEmptyRow).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
Related
I am trying to figure this out and I am hoping you can help
Basically I have Form and Data Sheet. I am looking to copy the information in the form into a new blank row within Table1 on the data sheet,
I have managed to get as far as the following but this causes the data to be over written each time, (rather than a a new row).
Sub Macro1()
Sheets("Form").Select
Range("G5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Data").Select
Range("Table1[[#Headers],[ID]]").Select
Selection.End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Form").Select
Range("D3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Data").Select
Range("Table1[[#Headers],[Contact Date]]").Select
Selection.End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Form").Select
Range("D4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Data").Select
Range("Table1[[#Headers],[Channel]]").Select
Selection.End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Form").Select
Range("D5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Data").Select
Range("Table1[[#Headers],[Agent Name]]").Select
Selection.End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Form").Select
Range("D6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Data").Select
Range("Table1[[#Headers],[Contact ID]]").Select
Selection.End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Form").Select
Range("G3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Data").Select
Range("Table1[[#Headers],[Scored by]]").Select
Selection.End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Form").Select
Range("G4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Data").Select
Range("Table1[[#Headers],[Team Leader]]").Select
Selection.End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
I realise this may seem like a simple question but I am struggling to work this out.
FYI - There will be 29 Columns to this table so If I should be doing something to make this cleaner, please let me know
Here's a more streamlined way to approach this:
EDIT - updated to add "config" array to reduce repetition
Sub Transfer()
Dim config, itm, arr
Dim rw As Range, listCols As ListColumns
Dim shtForm As Worksheet
Set shtForm = Worksheets("Form") '<< data source
With Sheets("Data").ListObjects("Table1")
Set rw = .ListRows.Add.Range 'add a new row and get its Range
Set listCols = .ListColumns 'get the columns collection
End With
'array of strings with pairs of "[colname]<>[range address]"
config = Array("ID<>G5", "Contact Date<>D3", "Channel<>D4")
'loop over each item in the config array and transfer the value to the
' appropriate column
For Each itm In config
arr = Split(itm, "<>") ' split to colname and cell address
rw.Cells(listCols(arr(0)).Index).Value = shtForm.Range(arr(1)).Value
Next itm
End Sub
No copy/paste/select/activate required.
I currently have a spreadsheet that calculates variances in columns D and E. At the end of the month I would like to copy and paste the values into another columns in another worksheets (D copy values in "Historical loan count", E - in "Historical UPB) to keep track of the variances month to month.
I have developed a macro that copies the contents that need to be copied from columns D and E to columns N. But What I really need is that each time I run the macro it to copy the values from columns D and E and paste it into a new next column in other worksheets.
I found a similar question here (Copy and Paste data inside one workbook). The problem was resolved with using Offset property but, if I understand right, I can't apply Offset with different worksheets.
Sheets("Forecast Tableau format").Select
Range("D3:D6").Select
Selection.Copy
Sheets("Historical Loan Count").Select
Range("N2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Forecast Tableau format").Select
Range("D7:D10").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical Loan Count").Select
Range("N9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=6
Sheets("Forecast Tableau format").Select
Range("D11:D14").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical Loan Count").Select
Range("N16").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Forecast Tableau format").Select
Range("D15:D18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical Loan Count").Select
Range("N23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Forecast Tableau format").Select
Range("D19:D22").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical Loan Count").Select
ActiveWindow.SmallScroll Down:=3
Range("N30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Forecast Tableau format").Select
Range("E3:E6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical UPB").Select
ActiveWindow.SmallScroll Down:=-3
Range("N2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Forecast Tableau format").Select
Range("E7:E10").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical UPB").Select
Range("N9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Forecast Tableau format").Select
Range("E11:E14").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical UPB").Select
Range("N16").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=3
Sheets("Forecast Tableau format").Select
Range("E15:E18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical UPB").Select
Range("N23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=6
Sheets("Forecast Tableau format").Select
Range("E19:E22").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Historical UPB").Select
Range("N30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
I have made a Macro that performs some repetitive tasks (updates certain data connections and transfers this information to another Excel). The code works perfectly, however, sometimes, it changes the formatting of certain cells, in worksheets, that are not even called in the Macro.
This sounds as a bug. I have previously had the same problem, that was solved by removing the On Error Resume Next line.
Could you please read my code, and see if there is something that could be causing this bug? I really cannot allow to lose my formatting since I am using these sheets for important company reports.
Before running the Macro:
After running the Macro:
Here goes my code:
Sub TRANSFER_INPUT()
'
' TRANSFER_INPUT Macro
'
Dim MWWorkBook As Workbook
Set MWWorkBook = ActiveWorkbook
Sheets("PAR").Select
Dim Pateka As String
Worksheets("PAR").Activate
Pateka = Range("E5").Value
Dim Datum1 As String
Worksheets("PAR").Activate
Datum1 = Range("E6").Value
Dim InputExcel As Workbook
Workbooks.Open Filename:=Pateka & "INPUT" & Datum1 & ".xlsx", UpdateLinks:=3
Set InputExcel = ActiveWorkbook
'###
'MAIN WORKBOOK / PREFRLANJE FAJLOVI
'###
'INPUTBILANS
MWWorkBook.Activate
Sheets("INPUTBILANS").Select
Range("F11:M1000").Select
Selection.Copy
Range("Y11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'REFRESH BILANS VO INPUT
MWWorkBook.Activate
Sheets("INPUTBILANS").Select
Range("F10").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
'###
'###
'PREFRLI VO INPUT
'###
'###
'Kopiraj Bilans_1
Range("F11:V1000").Select
Selection.Copy
'Pastiraj Bilans_1 VO INPUT / Bilans_1 vo Bilans_2
InputExcel.Activate
Sheets("BILANS_1").Select
Range("B8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("B8:R1000").Select
Selection.Copy
Sheets("BILANS_2").Select
Range("B8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
''' PREFRLI I KOPIRAJ COSTS
MWWorkBook.Activate
Sheets("COSTS").Select
Range("A4").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("A5:AV312").Select
Selection.Copy
InputExcel.Activate
Sheets("COSTS").Activate
Range("A5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'Kopiraj OPER.COST
MWWorkBook.Activate
Sheets("OPER.COST | NONOP | PRIHODI").Select
Range("D7").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("G16:P63").Select
Selection.Copy
InputExcel.Activate
Sheets("OPER.COST").Select
Range("Z4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'Kopiraj PRIHODI
MWWorkBook.Activate
Sheets("OPER.COST | NONOP | PRIHODI").Select
Range("D65:F204").Select
Selection.Copy
InputExcel.Activate
Sheets("PRIHODI").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'Kopiraj NONOP
MWWorkBook.Activate
Sheets("OPER.COST | NONOP | PRIHODI").Select
Range("F8:F14").Select
Selection.Copy
InputExcel.Activate
Sheets("NONOP").Select
Range("D5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
Thank you so much!
I'm work on this project where I have a summary sheet and a data sheet where I want to drop in raw data from a separate report weekly into the data sheet and filter through what I need and copies to the summary sheet.
The start of the code is simply clearing out the cells for a new run each time. The problem I'm having is the one autofilter criteria that is a cell value from the summary sheet. It is a drop down box with that will when changed, copy different data to the summary sheet. Here is my code. Thanks for any advice in advance!
Sub Macro3()
Sheets("Summary").Select
Range("C5").Select
Selection.ClearContents
Range("C6").Select
Selection.ClearContents
Range("C10").Select
Selection.ClearContents
Range("C11").Select
Selection.ClearContents
Range("C16").Select
Selection.ClearContents
Range("C17").Select
Selection.ClearContents
Range("C21").Select
Selection.ClearContents
Range("C22").Select
Selection.ClearContents
Range("F11").Select
Selection.ClearContents
Range("F10").Select
Selection.ClearContents
Range("F6").Select
Selection.ClearContents
Range("F5").Select
Selection.ClearContents
Sheets("Data").Select
Range("K200000").Select
Selection.ClearContents
Range("J200000").Select
Selection.ClearContents
i = Sheets("Summary").Range("i2")
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=13, Criteria1:=i
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=7, Criteria1:="<>"
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=11, Criteria1:="<>0"
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15, Criteria1:=i
Range("K200000").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-199996]C:R[-1]C)"
Range("J200000").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(2,R[-199996]C:R[-1]C)"
Selection.NumberFormat = "#,##0.0"
Selection.NumberFormat = "#,##0"
Selection.Copy
Sheets("Summary").Select
Range("C5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
Range("k200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("C10").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15, Criteria1:="<>" & i
Range("j200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("C6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
Range("k200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("C11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=7
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=11
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=12, Criteria1:= _
"<>"
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15, Criteria1:=i
Range("j200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("C16").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
Range("k200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("C21").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15, Criteria1:="<>" & i
Range("j200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("C17").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
Range("k200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("C22").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=12
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4, Criteria1:="<>0"
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15, Criteria1:=i
Range("j200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("F5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
Range("k200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("F10").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15, Criteria1:="<>" & i
Range("j200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("F6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
Range("k200000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("F11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Data").Select
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=13
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=15
Sheets("Summary").Select
End Sub
As Peh says, this is pretty much unreadable. From your question though, I think your problem refers to setting the criteria to i? If so, try changing
i = Sheets("Summary").Range("i2")
to
i = Sheets("Summary").Range("i2").Value
The problem I face at the moment is a sub-procedure within a module I have called "Update" (which has already been written) which I want to do the following;
Select the “Sheet2” sheet data (one row, A4:KL4) and copy to the “master” sheet in sequence to the data that has been recorded above it.
The sub procedure also needs to include another function of searching the “master” sheet for previous entries of the reference number and only copying the “Sheet2” row data if the reference number does not already exist.
If the reference number already exists then it then needs to check the date of the previous entry. If it’s the same date, then I want the sub procedure to overwrite what has already been saved. If the date is different, then I want the sub-procedure to add the “Sheet2” sheet to a new row.
If anyone can help I would greatly appreciate it. I have checked other posts and have even tried using some of the code from previous answers but it doesn't seem to work for me.
Sub update1()
Sheets("loading").Select
Application.ScreenUpdating = False
Sheets("Current Audit").Select
Range("J76").Select
Selection.Copy
Range("AG4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("J77").Select
Application.CutCopyMode = False
Selection.Copy
Range("AF4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B75").Select
Selection.Copy
Range("Q4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B76").Select
Selection.Copy
Range("R4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B77").Select
Selection.Copy
Range("S4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B78").Select
Selection.Copy
Range("T4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B79").Select
Selection.Copy
Range("U4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B80").Select
Selection.Copy
Range("V4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B81").Select
Selection.Copy
Range("W4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("B82").Select
Selection.Copy
Range("X4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B83").Select
Selection.Copy
Range("Y4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B84").Select
Selection.Copy
Range("Z4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("B85").Select
Selection.Copy
Range("AA4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B86").Select
Selection.Copy
Range("AB4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B87").Select
Selection.Copy
Range("AC4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("B88").Select
Selection.Copy
Range("AD4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B89").Select
Selection.Copy
Range("AE4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AF5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("AG5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("Q5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("R5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("S5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("T5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("U5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("V5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("W5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("X5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("Y5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("Z5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("AA5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("AB5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("AC5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("AD5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("AE5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GA5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GE5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GI5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GM5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GP5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GR5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GU5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GW5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("GZ5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("HB5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("HE5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("HH5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
Range("HK5").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
End Sub
I prefer to save my data into an array first, manipulate it and then dump the results into the new range. Arrays are easier and faster to manipulate in general.Also, it is much easier to create an array of formulas (in your case an array of:
"=IF(R[-1]C=""N/A"",""N/A"",R[-1]C*100)"
e.g.
Dim YourArrayContainingFormulas() As Variant
Redim YourArrayContainingFormulas(1 to 10)
For i = 1 To 10
YourArrayContainingFormulas(i)="=YourFormula"
Next i
and copy it to a selected range like this:
With ActiveCell
Range(.Offest(0,0),.Offset(0,9)).Value=YourArrayContainingFormulas
End With