Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Ignoring a blank cell while running a macro.

Dear All

I have the following macro attached to a button to copy data F10:G40
(This months figures) to next free columns, so I can build up a yrs
worth of data. I then repopulate F10:G40 with the new months data,
then at the end of the month click the button and start over. The
problem is column "H" which is blank. I want the macro to start
pasting from column " I ". Is there a macro txt string that will ignor
a blank cell.

I don't want to nominate a particular cell, say =IF(C:C) because when
I transfer this to another sheet, the refs won't be the same. I just
need to generically skip any blanks.

Thanks in advance.

P.S I am new to macros so don't get all your terminology, sorry but it
needs to be idiot proof !!!

Range("F10:G40").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=-30 (Question ? what does this mean &
can I take it out ?)
ActiveCell.End(xlToRight).Select
ActiveCell.Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone,
_
SkipBlanks:=False, Transpose:=False
Range("A1").Select

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Ignoring a blank cell while running a macro.

On Oct 11, 4:09*am, Decreenisi wrote:
Dear All

I have the following macro attached to a button to copy data F10:G40
(This months figures) to next free columns, so I can build up a yrs
worth of data. I then repopulate F10:G40 with the new months data,
then at the end of the month click the button and start over. The
problem is column "H" which is blank. I want the macro to start
pasting from column " I ". Is there a macro txt string that will ignor
a blank cell.

I don't want to nominate a particular cell, say =IF(C:C) because when
I transfer this to another sheet, the refs won't be the same. I just
need to generically skip any blanks.

Thanks in advance.

P.S I am new to macros so don't get all your terminology, sorry but it
needs to be idiot proof !!!

Range("F10:G40").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=-30 (Question ? what does this mean &
can I take it out ?)
ActiveCell.End(xlToRight).Select
ActiveCell.Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone,
_
SkipBlanks:=False, Transpose:=False
Range("A1").Select

End Sub


If I understand what you want, try just this. But wouldn't it be
better to copy below?
Sub copyrange()
Dim dlc As Long
dlc = Cells(10, Columns.Count).End(xlToLeft).Offset(, 2).Column
Range("F10:G40").Copy
With Cells(10, dlc)
.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteColumnWidths
End With
Application.CutCopyMode = False
Range("A1").Select
End Sub

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
if every cell is larger than x, but ignoring blank cells philnotfil Excel Worksheet Functions 1 July 7th 10 08:39 PM
Select next blank cell in column, before running macro BadRasta Excel Programming 2 July 11th 09 12:28 PM
Want to check if cell is blank before running macro Munchkin Excel Programming 5 June 3rd 09 11:59 PM
Highlight Lowest value ignoring 0 or blank cell Marie Excel Discussion (Misc queries) 3 June 4th 08 11:04 PM
showing a cell when it is not blank and ignoring it if it is Neil Excel Discussion (Misc queries) 2 September 17th 07 10:23 AM


All times are GMT +1. The time now is 07:19 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"