?
Solved

VBA - Paste MSHFlexgrid1 to excel cell

Posted on 2013-01-09
6
Medium Priority
?
261 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 49

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 49

Accepted Solution

by:
Martin Liss earned 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 49

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 49

Expert Comment

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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

718 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