Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default A macro to tell excel to input to next empty cell

This is my code, and it works, but now I need to close the empty spaces. For
example, I have approximately 10 possible ranges check for contents and if
they contain text, then to copy and paste into an area on my spreadsheet that
can only accommodate 5 cells. Not all of the 10 will contain text -- say 3
out of 10 will actually hold text, or 2 out of 10, etc., but for those that
do hold text, I want to see the values in the 5 cells or less. Is there a
way to accomplish this?

Sheets("Morning Report Database").Select
Range("Y2").Select
If ActiveCell.Value < "" Then
Selection.Copy
Sheets("CHEATSHEET").Select
Range("B6").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=False

ElseIf ActiveCell = "" Then
ActiveCell.Offset(RowOffset).Activate
End If

Sheets("Morning Report Database").Select
Range("Y3").Select
If ActiveCell.Value < "" Then
Selection.Copy
Sheets("CHEATSHEET").Select
Range("B7").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=False

ElseIf ActiveCell = "" Then
ActiveCell.Offset(RowOffset).Activate
End If

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default A macro to tell excel to input to next empty cell

Something along the lines of

icol = 1
for each cell in 10CellRange
if not isempty(cell) then
worksheets(2).Cells(irow,icol).Value = cell.value
icol = icol + 1
end if
Next


--
Regards,
Tom Ogilvy

"Help Me Rhonda TOA" wrote in
message ...
This is my code, and it works, but now I need to close the empty spaces.

For
example, I have approximately 10 possible ranges check for contents and if
they contain text, then to copy and paste into an area on my spreadsheet

that
can only accommodate 5 cells. Not all of the 10 will contain text -- say

3
out of 10 will actually hold text, or 2 out of 10, etc., but for those

that
do hold text, I want to see the values in the 5 cells or less. Is there a
way to accomplish this?

Sheets("Morning Report Database").Select
Range("Y2").Select
If ActiveCell.Value < "" Then
Selection.Copy
Sheets("CHEATSHEET").Select
Range("B6").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,

SkipBlanks:= _
True, Transpose:=False

ElseIf ActiveCell = "" Then
ActiveCell.Offset(RowOffset).Activate
End If

Sheets("Morning Report Database").Select
Range("Y3").Select
If ActiveCell.Value < "" Then
Selection.Copy
Sheets("CHEATSHEET").Select
Range("B7").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,

SkipBlanks:= _
True, Transpose:=False

ElseIf ActiveCell = "" Then
ActiveCell.Offset(RowOffset).Activate
End If



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
Excel macro which prompts for input and moves to a cell - repeated KenZimbo Excel Worksheet Functions 2 September 8th 08 02:02 PM
run macro with input msg based on cell input Janelle S Excel Discussion (Misc queries) 0 January 20th 08 05:23 AM
Getting a macro to see the next available empty cell Mark 688 Excel Discussion (Misc queries) 1 September 9th 05 04:19 PM
macro to look for empty cell esrei Excel Discussion (Misc queries) 1 April 14th 05 11:57 AM
Need help with empty cell in Macro Don Excel Programming 4 September 30th 04 02:50 AM


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

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

About Us

"It's about Microsoft Excel"