Solved

VBA - Paste MSHFlexgrid1 to excel cell

Posted on 2013-01-09
6
257 Views
Last Modified: 2013-01-09
Hello all

I would like to transfer whats in my MSHFlexgrid to my excel cell a specific way but i don't know how to do it.

I would like to start transferring the MSHFlexgrid1 rows on the first empty cell in column A starting at row 5 going down.

I also want to transfer the MSHFlexgrid1 bu rows this way:
MSHFlexgrid1 column 1 in column D in excel
MSHFlexgrid1 column 6 in column F in excel
MSHFlexgrid1 column 9 in column U in excel

How can i do that?

Thanks again for your help
0
Comment
Question by:Wilder1626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 47

Expert Comment

by:Martin Liss
ID: 38759266
I haven't tested this but see if this works.

Dim r As Integer
Dim c As Integer
Dim lngRow As Long

For r = 5 To 65000
    If Cells(r, 1).Value = "" Then
        Exit For
    End If
Next

For lngRow = 1 To MSHFlexGrid1.Rows
    Cells(r, 4).Value = MSHFlexGrid1.TextMatrix(lngRow, 1)
    Cells(r, 6).Value = MSHFlexGrid1.TextMatrix(lngRow, 6)
    Cells(r, 21).Value = MSHFlexGrid1.TextMatrix(lngRow, 9)
    r = r + 1
Next

Open in new window

0
 
LVL 11

Author Comment

by:Wilder1626
ID: 38759302
Hi MartinLiss

I have this Run-Time Error 6: Overflow on
For r = 5 To 65000

Open in new window


do you why?
0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 38759322
I'm sorry

Dim r As Long

But you shouldn't be running into that error because r should find a value in col A before r gets to big (an integer can only go to 32,767). Also you don't need 'c'.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 47

Expert Comment

by:Martin Liss
ID: 38759326
Can you attach your WB?
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 38759377
Oh this is again so good.

Thanks again for your help.

all work great now.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 38759564
You're welcome.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question