ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy outside Clipboard contents (html page) to a cell in Excel (https://www.excelbanter.com/excel-programming/339000-copy-outside-clipboard-contents-html-page-cell-excel.html)

sifar

Copy outside Clipboard contents (html page) to a cell in Excel
 
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


Nick Hebb

Copy outside Clipboard contents (html page) to a cell in Excel
 
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


gr8guy[_2_]

Copy outside Clipboard contents (html page) to a cell in Excel
 
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 ***


All times are GMT +1. The time now is 12:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com