Op een snelle manier velden kopieren en plakken

Mercilessy

New Member
Joined
Nov 5, 2015
Messages
2
Hallo,

Ik ben op zoek naar een macro die op een snelle manier cellen van excel naar een aangifte programma kan kopieren. Bij ons op werk hebben al onze gegevens omgezet in excel. Enige wat nog gedaan moet worden is dit kopieren in een aangifte programma.

Wat wij dus doen is, cel A1 control C en control V bij hokje 1. Vervolgens cel A2 control C en Control V bij hokje 2. En zo gaat dit door... Ik wil dus een macro dit voor mij automatisch doet, in onze aangifte system is het mogelijk om te tabben.

Dus ik kan vanuit Hokje 1 doortaben naar hokje 2,3,4,5 etc. Ooit heeft iemand mij hierbij geholpen en dit door gestuurd.
Rich (BB code):
Sub CopyText(Text As String)
    'http://excel-macro.tutorialhorizon.com/vba-excel-putting-text-in-the-windows-clipboard/
    'VBA Macro using late binding to copy text to clipboard.
    'Thanks to Late Binding MSForms.DataObject to access the ClipBoard from VBA.
    Set MSForms_DataObject = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    MSForms_DataObject.SetText Text
    MSForms_DataObject.PutInClipboard
    Set MSForms_DataObject = Nothing
End Sub
Sub New_CopySelection()
Dim lr As Long
Dim c As Range
Dim rng As Range

Set rng = Selection

For Each c In Selection

If c.Value <> "" Then
CopyText c.Value
Application.Visible = False
SendKeys "^v"
Application.Visible = True

Else
Application.Visible = False
Application.SendKeys ("{TAB}")
Application.Visible = True
End If
Next
Application.Visible = True

End Sub
Het probleem bij deze macro is dat ik iedere cel 1 voor 1 moet selecteren. Wat ik wil is dus cel a1 tot en met a20 selecteren en dat alles doorkomt.

Ik hoop dat iemand mij kan helpen..
 
Last edited by a moderator:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Mischien kan je wat met deze code die gebruikte ik om Oracle velden 1 voor 1 in te vullen.

Data die nu ingesteld staat die 1 voor 1 gekopieerd word is :
Kollomen A,B,C,D,E,F,G,H,I
Rijen(radky) tot er geen data meer staa,t met een beetje zelf programeer werk kom je er vast wel uit.

Origineel had ik bij programmanaam deze text staan : "Oracle Applications - XXX PROD Env."

Succes :)

Code:
Sub TransProgram()

    Set WshSh = CreateObject("WScript.Shell")
    Set WshNet = CreateObject("WScript.Network")
'Check of programma open is
If WshSh.AppActivate("Programmanaam") = True Then
    WshSh.AppActivate ("Programmanaam")
    Else
    MsgBox ("Programma is niet open")
    Stop
End If

'select sheet
Sheets("Sheet1").Select
radky = Range("A1").CurrentRegion.Rows.Count
For i = 2 To radky
   
    Data = Array(Range("A" & i), Range("B" & i), Range("C" & i), Range("D" & i), Range("E" & i), Range("F" & i), Range("G" & i), _
                 Range("H" & i), Range("I" & i))
    
    Application.Wait Now + TimeSerial(0, 0, Range("O3"))
    a = 0
    For a = 0 To 8
        SendKeys Data(a)
        SendKeys "{ENTER}"
        Application.Wait Now + TimeSerial(0, 0, Range("O2"))
    
    Next a
    SendKeys "{ENTER}"
    
Next i
MsgBox ("Klaar!")
End Sub
 
Last edited by a moderator:
Upvote 0
Mercilessy,
Google een keertje met "automate keystrokes and mouse clicks", dan heb je verschillende programma's waar je m.i. dit mee kunt automatiseren
 
Upvote 0
Uw aangifteprogramma heeft toevallig geen xml-interface? Anders kan je vanuit Excel een xml aanmaken en die zo insturen. De meeste aangiftes worden meer en meer op die manier aangepakt.
 
Upvote 0

Forum statistics

Threads
1,215,757
Messages
6,126,695
Members
449,331
Latest member
smckenzie2016

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