Monday, 15 July 2013

excel - How to make selection move through variable data in VBA -


I am trying to continue the processes until the end of cells, but the selection needs to be changed in a fixed order. . Here's the code:

  'C_P macro' copies from worksheets & amp; Keyboard shortcut 'pastes' in new sheet. Ctrl + Shift + L Dim Rng1 Range Dim String Dims as the iRow integer look with Windows ("Audubon-Crest-Rent Roll-201502-1 .xlsx") set active rng1 = range (" A: A ") ActiveCell = Range (" A228 ") Whether Windows (" Audubon-Crest-Rent Roll-201502-1.xlsx ") Active Range (" A228: A239 "). Select Selection.Copy Windows .. ("Audubon Crest Roll Rent 20,150,219-altered.xlsm") Active Range ("B17") Selection.PasteSpecial Paste Select: = xlPasteAll, Operation: = xlNone, SkipBlanks: = _ False, moved: = True Windows ("Audubon -Crest-Rent-roll-201502-1.xlsx ") Active Application.CutCopyMode = False Range (." A228: A239 ".) Offset (13, 0) .Select Selection.Copy Windows (" Audubon Crest Rolls Roll 20150219 - altered.xlsm ".) Active range (" B17 ".) Offset (1, 0) .Select Selection.Paste Special Paste: = xlPasteAll, Operation: = xlNone, SkipBlanks: = _ false, moved: = true range (" B18 "). As you can see, what is basically 11 rows of the ending sub  

like with the escape (cell (iRow, 1)) termination And then move data into copies Next workbook in the next line I can process through F8 and I can tell that if it works well for a selection then goes down 13 rows and makes the next selection, but I'm not sure this data How to run continuously through the medium. I always need to select 11 rows, in the process then count thirteen rows and unless it hits an empty line, ideally I can set it to find a certain cell entry and 11 rows Once I can select this, when the next instance of this cell entry is revealed, but I think that 13 rows have remained as a pattern, if it is right 13th Ktion should fix.

So, I think my quarters is how to do line selection variables when I see the code, then I can see that my line selection is solid values, so if I run the macro then Will not go, it will only do those cells which I have indicated. How can I lower it through cells?

You do not have to activate a workbook, do something with a category in it In a non-active workbook, you can do something with a limit that is in the workbook before qualifying. The same applies to worksheets and categories It is not valid that the code-sample you are posting is not causing problems because you are not actually touching it, but it is very much in reading your code. Making it difficult.

A possible solution: Your problem is a macro that looks like this:

  In the form of a sub-copy versus sourcebook workbook, as the Dest book workbook, the range Set the range in the form of strontange, range set source book = workbook (set "Audubon-crest-roll-201502-1.clux" "set destBook = workbooks (" Audubon crest rent roll 20150219-replace.exmlM ") Do source = sourcebook. Sheets (& lt; sheet name is in the form of data string & gt;). Range ("A228: A239") set destRange = destBook.Worksheets (& lt; sheet name will be copied as data string & gt; ;) Range (. "B17") what sourceRange.Copy destRange.Paste Special Paste: = xlPasteAll, Operation: = xlNone, Excluded Box: = Incorrect, Transpose: = True Application.CutCopyMode = Fault Set Distribution = Distant. Offset ( 1, 0) Set SourceRange = sourceRange.Offset (source code) until the end, (source code) up to the end of the sub  

As you can see I define the categories that will be copied, by giving them names and then excel where they are using the set statement for each iteration of the loop, I set it to destination again I take the border one line further down, and by giving it offset by a line from the previous destination border, I do this also with the source range, but I'm offset it from 13 rows. , Looks like it was in your code samples.

I hope it helps!


No comments:

Post a Comment