Friday, September 23, 2016

How to Fix - create a source sheet file with data in another sheet?

create a source sheet file with data in another sheet

I want to create a source sheet with the data in another sheet starting from the 2nd row till the end; here my (wrong) code: please help me!!!
Dim lastrow As Integer
Dim posting_key As Integer
Dim account As Integer
Dim amount As Integer
Dim cost_center As Integer
Dim profit_center As Integer
Dim text As Integer
lastrow = Range("A65536").End(xlUp).Row

    For i = 2 To lastrow
        posting_key = Cells(i, 10)
        account = Cells(i, 3)
        amount = Cells(i, 7)
        cost_center = Cells(i, 9)
        profit_center = Cells(i, 11)
        text = Cells(i, 12)
        For j = 1 To lastrow
            Range("a4").Offset(j, 0).Select.Value = posting_key
            Range("a4").Offset(j, 1).Select.Value = account
            Range("a4").Offset(j, 2).Select.Value = amount
            Range("a4").Offset(j, 3).Select.Value = cost_center
            Range("a4").Offset(j, 5).Select.Value = profit_center
            Range("a4").Offset(j, 7).Select.Value = text
        Next j
    Next i
End Sub

Anwsers to the Problem create a source sheet file with data in another sheet

Download SmartPCFixer to Fix It (Free)

Using Select and looping through what could be a large number of rows is slower than a direct method of transferring the values in cells.
Try this approach,
Sub make_new()
    Dim rws As Long
    With Sheets("Output")
        rws = .Cells(Rows.Count, 1).End(xlUp).Row - 1
        Sheets("JE").Cells(5, 1).Resize(rws, 1) = .Cells(2, 10).Resize(rws, 1).Value
        Sheets("JE").Cells(5, 2).Resize(rws, 1) = .Cells(2, 3).Resize(rws, 1).Value
        Sheets("JE").Cells(5, 3).Resize(rws, 1) = .Cells(2, 7).Resize(rws, 1).Value
        Sheets("JE").Cells(5, 4).Resize(rws, 1) = .Cells(2, 9).Resize(rws, 1).Value
        Sheets("JE").Cells(5, 6).Resize(rws, 1) = .Cells(2, 11).Resize(rws, 1).Value
        Sheets("JE").Cells(5, 8).Resize(rws, 1) = .Cells(2, 12).Resize(rws, 1).Value
    End With
End Sub

Cleaning your computer, components, and peripherals help keep everything in good working condition and helps prevent germs from spreading. You can't image how dirty the inside of your computer case can get. All the dust and dirt is going to prevent proper air flow and may even prevent the fan from working.

Recommended Method to Fix the Problem: create a source sheet file with data in another sheet:

How to Fix create a source sheet file with data in another sheet with SmartPCFixer?

1. Click the button to download Error Fixer . Install it on your computer.  Run it, and it will scan your computer. The junk files will be shown in the list.

2. After the scan is done, you can see the errors and problems need to be fixed. Click Fix All.

3. When the Fixing part is finished, your computer has been speeded up and the errors have been removed

Related: How Can You Update & Download NVidia 6100, 6800 GS/XT Display Driver v.260.89 WHQL,Where to Download NVidia GeForce 8800 GT WHQL-certified driver v.196.21,How to Update & Download NVidia GeForce Go 7400 Display Driver v.260.19.12,[Solved] Download NVidia GeForce GTX 460M Driver v.331.82,Download NVidia Quadro Plex Model IV VGA Driver v.304.43 Certified,Way to Download RealTek RTL8100C(L) Driver v.5.01,Way to Download RealTek RTL8100E Drivers v.694,Way to Update & Download RealTek RTL8101L Auto Installation Program v.6.110 driver,Method to Update & Download RealTek RTL8111G PXE and RPL ROM code v.2.58 driver,How to Update & Download RealTek RTL8411B(N) Driver v.10.003,Best Way to Update & Download ASUS A53SV nVidia Graphics Driver v.,Method to Herunterladen ASUS K75VJ Intel Rapid Storage Technology Treiber v.,How Can You Update & Download ASUS CG8580 Intel Chipset Driver v.,Method to Update & Download ASUS K41VD Intel INF Update Driver v.,Way to Update & Download ASUS Pro70T NB Probe v.3.0.0026 driver
Read More: How to Fix Error - connection settings do not match network requirements?,Troubleshooting:convert equation from equation editor to microsoft 2007,Convert cells (pasted from another application) to date format [Solved],How to Fix Problem - Contact transfer from Live account back onto Nokia 710 Windows phone?,How to Fix Error - Connection to Internet Explorer has ended before I decide?,Closing Internet Explorer causes error,Compare 2 Tables and Calculate the PROFIT Faster,Computer goes to Windows Boot Manager after Start,Connect to one of my network computer remotely when don't allow exception box Marked,computer locking up randomly

No comments:

Post a Comment