Copy outside Clipboard contents (html page) to a cell in Excel

S

sifar

Hi,

I have a webpage from which i am selecting & copying vertical data. Now
I open Excel & select Cell A5 & then right-click & select PasteSpecial,
then in PasteSpecial window, select Values & Transpose, to transpose
data horizontally.

I want to automate the whole process so that once i select & copy
webpage data, it should already be available in windows Clipboard, so
that once i open Excel, i just need to click on a button & it will
collect data & paste it horizontally from cell A5.

Also, once row cells are filled, the next time i enter another webpage
data, it should paste it horizontally to cell A6 below.

Please help!

Sifar
 
N

Nick Hebb

Dim i As Long

i = ActiveSheet.UsedRange.Rows.Count + 1
Range("A" & i).PasteSpecial Paste:=xlPasteValues, Transpose:=True

The value for 'i' above will only work if there are no other entries in
other columns in rows below the target. If so, search 'last cell' in
this group to find plenty of examples on how to get the last non-empty
row in a column.

HTH,

Nick Hebb
http://www.breezetree.com
 
G

gr8guy

Hi,

Thanks for Replying. I am trying this code to get clipboard contents.

=============================================
Public Function GetOffClipboard() As Variant

Rem Here, if Clipboard is empty, i get an Error message. I want to let
user know that he/she has not copied anything to clipboard & then either
exit from or ask for input. How do i check if Clipboard is Empty?

Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
GetOffClipboard = MyDataObj.GetText()
End Function

Sub Pastetxt()
With Worksheets(1)
GetOffClipboard
Dim i As Long

Rem I need a Check here. so that it can detect Row empty & paste the
clipboard content into each Column cell on Current ROW. Sort of a LOOP
which will check if the current row is Empty or not. If its Empty, will
paste Clipboard contents to current ROW(always starting from 1st
Column), Else will move Row+1 i.e. next Row & then Paste to Below Row.

i = ActiveSheet.UsedRange.Rows.Count + 1
.Range("A" & i).PasteSpecial Paste:=xlPasteValues, Transpose:=True
End With
End Sub

Warm Regards,

Eijaz


*** Sent via Developersdex http://www.developersdex.com ***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top