Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to copy a highlighted row


Hello,

Im a beginning VBA programmer here. Could someone give me an idea o
how to highlight a row of numbers and have the macro go down th
columns and check to see if a cell is empty and moving on to the nex
column if it is? Also, I would like to copy the numbers that AR
present so I could copy it to another application. Thanks

--
broncote
-----------------------------------------------------------------------
broncoted's Profile: http://www.excelforum.com/member.php...fo&userid=3640
View this thread: http://www.excelforum.com/showthread.php?threadid=56178

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default How to copy a highlighted row

You could record a macro to get an idea of most of the code.
Both parts of your question are too ambiguous for me to understand.
Also what is the other application looking for -- is it a CSV file?

For instance copy your sheet
Edit, Move or copy, be sure to mark the check box to create a copy
Select all cells on the worksheet, then Ctrl+G, select blank cells,
Edit delete, shift left
File, Save As, comma separated variable file (CSV)
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"broncoted" wrote in message
...

Hello,

Im a beginning VBA programmer here. Could someone give me an idea on
how to highlight a row of numbers and have the macro go down the
columns and check to see if a cell is empty and moving on to the next
column if it is? Also, I would like to copy the numbers that ARE
present so I could copy it to another application. Thanks!


--
broncoted
------------------------------------------------------------------------
broncoted's Profile: http://www.excelforum.com/member.php...o&userid=36401
View this thread: http://www.excelforum.com/showthread...hreadid=561789



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to copy a highlighted row


I guess what I need first is the following:

I want a user to highlight a row of information(just the part of the
row they want)

So lets say they highlight from C3 to C:10

In that range are the following information

5 (empty cell) 4 3 5 (empty cell) (empty cell) 8

I want to create a macro that reads the numbers in the highlighted
selection, while ignoring the empty cells so that when they copy it to
something else the output would be

5 4 3 5 8

I hope this makes sense.

Thanks again.




David McRitchie Wrote:
You could record a macro to get an idea of most of the code.
Both parts of your question are too ambiguous for me to understand.
Also what is the other application looking for -- is it a CSV file?

For instance copy your sheet
Edit, Move or copy, be sure to mark the check box to create a copy
Select all cells on the worksheet, then Ctrl+G, select blank cells,
Edit delete, shift left
File, Save As, comma separated variable file (CSV)
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"broncoted"
wrote in message
...

Hello,

Im a beginning VBA programmer here. Could someone give me an idea on
how to highlight a row of numbers and have the macro go down the
columns and check to see if a cell is empty and moving on to the

next
column if it is? Also, I would like to copy the numbers that ARE
present so I could copy it to another application. Thanks!


--
broncoted

------------------------------------------------------------------------
broncoted's Profile:

http://www.excelforum.com/member.php...o&userid=36401
View this thread:

http://www.excelforum.com/showthread...hreadid=561789



--
broncoted
------------------------------------------------------------------------
broncoted's Profile: http://www.excelforum.com/member.php...o&userid=36401
View this thread: http://www.excelforum.com/showthread...hreadid=561789

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default How to copy a highlighted row

The following will create a CSV file for use in another application
with your data (instrument readings?). During the run, if you have
old file in your temp directory with current sheetname you will be
asked if you want to replace it (Yes), at the end your file is brought up
in Notepad for your review.

Sub Macro20()
Dim filename As String, RC As Long
filename = "c:\temp\" & _
Replace(Application.ActiveSheet.Name, " ", "") & ".csv"

ActiveSheet.Copy 'creates a new workbook with one sheet
Cells.Select 'select ALL cells
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select 'reduce to only once cell selected

ActiveWorkbook.SaveAs filename:=filename, _
FileFormat:=xlCSV, CreateBackup:=False
'-- activeworkbook is the newly copied worksheet's workbook (.CSV)
ActiveWorkbook.Close savechanges:=False
RC = Shell("Notepad " & filename, 1) 'for your viewing pleasure
End Sub

The central part of the macro is based on recording a macro
Edit, Move or Copy, to book: (new book), and must place a check next to create a copy
Select ALL cells (Ctrl+A before Excel 2003, the gray button in any version)
Ctrl+G, Special, Blanks
Edit, Delete, Shift Left

For your information: Posting with your actual name would be appreciated
as would posting directly to the newsgroups rather than through spammy
websites involving vbulletin, and jelsoft software, designed to spam Google web
searches with material intended for newsgroups.
http://www.mvps.org/dmcritchie/excel/posting.htm


---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"broncoted" <broncoted. ...... wrote
I want to create a macro that reads the numbers in the highlighted [selected]
selection, while ignoring the empty cells so that when they copy it to
something else the output would be



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
deselecting a highlighted range after a VBA copy procedure Paul James[_3_] Excel Programming 6 April 25th 23 03:47 AM
Copy highlighted. sungen99 Excel Discussion (Misc queries) 1 May 5th 06 07:43 PM
Copy highlighted. sungen99[_89_] Excel Programming 1 May 4th 06 07:44 PM
Highlighted ED New Users to Excel 5 April 13th 06 09:31 PM
Macro to copy highlighted cells to csv file Martin[_23_] Excel Programming 1 March 14th 06 07:56 PM


All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"